91-9990449935 0120-4256464 |
Java JSONThe json.simple library allows us to read and write JSON data in Java. In other words, we can encode and decode JSON object in java using json.simple library. The org.json.simple package contains important classes for JSON API.
Install json.simpleTo install json.simple, you need to set classpath of json-simple.jar or add the Maven dependency. 1) Download json-simple.jar, Or 2) To add maven dependency, write the following code in pom.xml file. 1) Java JSON EncodeLet's see a simple example to encode JSON object in java. Output: {"name":"sonoo","salary":600000.0,"age":27} Java JSON Encode using MapLet's see a simple example to encode JSON object using map in java. Output: {"name":"sonoo","salary":600000.0,"age":27} Java JSON Array EncodeLet's see a simple example to encode JSON array in java. Output: ["sonoo",27,600000.0] Java JSON Array Encode using ListLet's see a simple example to encode JSON array using List in java. Output: ["sonoo",27,600000.0] 2) Java JSON DecodeLet's see a simple example to decode JSON string in java. Output: sonoo 600000.0 27
Next TopicAJAX JSON Example
|