Hi All,
I have a question related to json-lib. Request some knowledgeable person to
answer the same.
Does the library have a generic method that returns JSON for any one of the
java object from the list below:
list of types that can be passed: Map, List, Number, Boolean, String,
array.
The reason I'm asking this question is - it seems like for maps, arrays and
list objects we can use JSONObject.fromObject(), but for types like Number,
Boolean, String we have to use JSONUtils.valueToString() . So, I was
wondering if I have to write a wrapper function above these two, so that I
can get a generic function that has to check if the object passed is Map,
List, array or rest and call suitable functions.
Thank you,
Venkatesh
|