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

JSON Object 

JSON Simple is a java library for encoding and decoding JSON text. Get the latest binaries from http://code.google.com/p/json-simple/. The following example shows serializing a simple JSON object.

File Name  :  
com/bethecoder/tutorials/json_simple/tests/First.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.json_simple.tests;

import org.json.simple.JSONObject;

public class First {

  /**
   @param args
   */
  public static void main(String[] args) {

    JSONObject obj = new JSONObject();
    obj.put("name""Sriram");
    obj.put("age"2);
    obj.put("hobby""painting");
    
    System.out.println(obj);
  }
}
   

It gives the following output,
{"age":2,"name":"Sriram","hobby":"painting"}


                    Print

   



Books Recommendation

 
 
bl  br