JSON.simple example – Read and write JSON

In this post,we will see how can we read and write JSON using json.simple.

Java JSON Tutorial Content:

JSON.simple, is a simple Java library for JSON processing, read and write JSON data and full compliance with JSON specification (RFC4627).

In this post,we will read and write JSON using JSON.simple.
Download JSON.simple jar from here.
Create a java project named “JSONSimpleExample”
Create a folder jars and paste downloaded jar json-simple-1.1.1.jar.
right click on project->Property->java build path->Add jars and then go to src->jars->json-simple-1.1.1.jar.

Click on ok.
Then you will see json-simple-1.1 jar added to your libraries and then click on ok

Write JSON to file:

Create a new class named “JSONSimpleWritingToFileExample.java” in src->org.arpit.java2blog

Run above program and you will get following output:

Read JSON to file:

Here we will read above created JSON file.
Create a new class named “JSONSimpleReadingFromFileExample.java” in src->org.arpit.java2blog

Run above program and you will get following output:

Project Structure:

Join Our Newsletter

Subscribe to Awesome Java Content

Add Comment

Join Our Newsletter

Subscribe to Awesome Java Content