tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 JSON > JSON JAVA > JSON Accumulate

JSON Accumulate 

JSON (JavaScript Object Notation) is a lightweight text-based open standard designed for human-readable data interchange. Douglas Crockford has provided a reference implementation of JSON in Java at useful for JSON serialization and deserialization. Click here to download the compiled library. The following example shows using accumulate method of JSONObject. It accumulates the values under a key. If we put multiple values for the same key, it replaces the value with a JSONArray containing all values.

File Name  :  
Author  :  Sudhakar KV
Email  :  [email protected]
package com.bethecoder.tutorials.json_java.tests;

import org.json.JSONException;
import org.json.JSONObject;

public class JsonAccumulate {

   @param args
   @throws JSONException 
  public static void main(String[] argsthrows JSONException {

    JSONObject jsonObj = new JSONObject();


It gives the following output,
{"certificates": "SCJA"}

{"certificates": [


bl  br