JSON Object Conversion (Java1.4)

JSON-lib is one of the standard library used for converting JSON String to any Custom Object and also any Custom Object to JSON String.

JSON-lib is one of the standard library used for converting JSON String to any Custom Object and also any Custom Object to JSON String.

This library is compatible even for lower versions of java., starting from JDK 1.3. However most of the libraries provide this functionalities starting from JDK 1.5.

The following libraries/dependencies are required along with json-lib library..,

For converting a String to JSONObject, JSONSerializer class is used in JSON-lib.

For converting a custom Object to String,JsonConfig and JSONSerializer classes are used.

We need to define the Object we need to convert in JsonConfig class.

Example Below:

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *