@@ -0,0 +1,1583 @@
+/**%0A * @file JSONEncodeDemo.java%0A * @author Valery Samovich%0A * @version 1.0.0%0A * @date 11/19/2014%0A *%0A * Following example makes use of JSONObject and JSONArray where JSONObject is %0A * java.util.Map and JSONArray is a java.util.List, so it's possible to access %0A * them with standard operations of Map or List.%0A */%0A%0Apackage com.valerysamovich.java.advanced.json;%0A%0Aimport org.json.simple.JSONArray;%0Aimport org.json.simple.JSONObject;%0Aimport org.json.simple.parser.JSONParser;%0Aimport org.json.simple.parser.ParseException;%0A%0Apublic class JSONDecodeDemo %7B%0A%0A    public static void main(String%5B%5D args) throws ParseException %7B%0A%0A        JSONParser parser = new JSONParser();%0A        String s = %22%5B0,%7B%5C%221%5C%22:%7B%5C%222%5C%22:%7B%5C%223%5C%22:%7B%5C%224%5C%22:%5B5,%7B%5C%226%5C%22:7%7D%5D%7D%7D%7D%7D%5D%22;%0A%0A        try %7B%0A            Object obj = parser.parse(s);%0A            JSONArray array = (JSONArray)obj;%0A            System.out.println(%22The 2nd element of array%22);%0A            System.out.println(array.get(1));%0A            System.out.println();%0A%0A            JSONObject obj2 = (JSONObject)array.get(1);%0A            System.out.println(%22Field %5C%221%5C%22%22);%0A            System.out.println(obj2.get(%221%22));%0A%0A            s = %22%7B%7D%22;%0A            obj = parser.parse(s);%0A            System.out.println(obj);%0A%0A            s= %22%5B5,%5D%22;%0A            obj = parser.parse(s);%0A            System.out.println(obj);%0A%0A            s= %22%5B5,,2%5D%22;%0A            obj = parser.parse(s);%0A            System.out.println(obj);%0A        %7D catch(ParseException pe) %7B%0A            System.out.println(%22position: %22 + pe.getPosition());%0A            System.out.println(pe);%0A        %7D%0A%0A    %7D%0A    %0A%7D%0A

Add Decode JSON Example.