In Java, I know that you can check if a key is present using the isNull () method. Is there a way to check what data the key stores?
Consider the following examples.
I need a function like JSONBody.getDataType ("key") and it will return String
{ "key" : "value" }
I need a function like JSONBody.getDataType ("key"), and it will return JSONObject
{ "key" : { "parm1" : "value1", "parm2" : "value2" } }
I need a function like JSONBody.getDataType ("key") and it will return a JSONArray
{ "key" : [ "value1", "value2", "value3" ] }
I need a function like JSONBody.getDataType ("key") and it will return a Boolean
{ "key" : true }
Is there something similar?
java json
David
source share