package jsonexample;
import net.sf.json.*;
/**
*
* @author raghuram
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
JSONObject object=new JSONObject();
object.put("id","er345");
object.put("designation","dfsf");
object.put("ctc",new Double(40));
object.put("allowance",new Double(66.67));
object.put("nickname","Babu");
System.out.println(object);
JSONArray jar=new JSONArray();
jar.add("hi");
jar.add(new Integer(25));
System.out.println("=======decode=======");
System.out.println("======the 2nd element of array======");
System.out.println(jar.get(1));
System.out.println();
JSONObject obj2=(JSONObject)jar.get(1);
System.out.println("======field \"1\"==========");
System.out.println(obj2.get("1"));
}
}
Subscribe to:
Post Comments (Atom)
Popular Posts
-
Hi folks, I got a chance to work with JSF, it was an interesting requirement. Its about a custom component which would be of more use to ...
-
Hi Folks, I would like to share my another POC task in JSF with you all. "Primefaces Dropdown with Pagination & Filter "...
-
We shall create temp table in mysql using the sql script CREATE TEMPORARY TABLE testraghu(name VARCHAR(50) , phone VARCHAR(50)) Let us se...
-
Hi all, i would like to share a simple example of storing haspmap in mysql db. In order to store object into your db, the field type must ...
No comments:
Post a Comment