s4553711
2/8/2013 - 7:42 AM

JSON in Java

JSON in Java

import org.json.*;
public static void main(String[] args) { 
    // Declare Hashtable
    Hashtable stor = new Hashtable();
    stor.put("Keya","a");
    stor.put("keyb","b")
    
    // Declare JSONObject and initialization with stor
    JSONObject jsonObject = new JSONObject(stor);
    // Output
    System.println(jsonObject.toString());
}