JSOn-Simple-101 Flashcards
What basically JSOn Simple uses internally to store the data?
Map & List
What is the full package ?
org.json.simple.*
What is the core object class?
JSONObject
What is official toString method?
toJSONString()
What we should use to write the json keys?
JSONArray
How is JSONArray differs itself with simple arrays?
With JSONArray you can have only keys to come or Full JSONObject or Object to come in. need not to explicitly say the Type casting as we do in Array
Say one e.g. for Put in JSONObejct with JSOnArray
JSONObject obj = new JSONObject(); obj.put(key, new Object());
JSONArray arr= new JSONArray(); arr.add("key1");
obj.put(“jkey”, arr);
So , put for JSONObject and add for JSONArray
What is @SuppressWarnings(“unchecked”)
This is eclispe warning, as it generally applies where the class doesnot support generics. Like JSONObject doesnot support generics
What does JSONObejct extends ?
extends HashMap
Which class will do the job of Parsing?
JSONParser
What is the method that will do the parsing in JSONParser and what it takes in?
parse
JSONParser parser = new JSONParser()
parser.parse(takes anyting that ultimately gives a String)
like Reader orString or Stream*
Explicit casting is required as it gives an Object
For Array better to use JSONArray