Jackson
- Streaming API or incremental parsing/generation: reads and writes JSON content as discrete events
- Tree model: provides a mutable in-memory tree representation of a JSON document
- Data binding: converts JSON to and from POJO.
<dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.9.8</version> </dependency>Check out complete tutorials and examples of Jackson library at Java Jackson JSON Tutorial with Examples.
GSON
Goals for Gson
- Provide easy to use mechanisms like
toString()and constructor (factory method) to convert Java to JSON and vice-versa - Allow pre-existing unmodifiable objects to be converted to and from JSON
- Allow custom representations for objects
- Support arbitrarily complex objects
- Generate compact and readable JSON output
<dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.8.5</version> <scope>compile</scope> </dependency>
JSON.simple
JSON.simple is a simple Java library for JSON processing, read and write JSON data and full compliance with JSON specification (RFC4627).The JSON-simple is one of the simplest JSON library, also lightweight. You can use this library to encode or decode JSON text. It's an open-source lightweight library which is flexible and easy to be used by reusing Map and List interfaces from JDK. A good thing about this library that it has no external dependency.
To use JSON.simple Java library, add below maven dependency:
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple --> <dependency> <groupId>com.googlecode.json-simple</groupId> <artifactId>json-simple</artifactId> <version>1.1.1</version> </dependency>Check out complete tutorials and examples of JSON.simple library at JSON.simple Tutorial - Read and Write JSON in Java.
JSON-P
| Name | Description |
|---|---|
| Json | Contains static methods to create JSON parsers, generators, and their factories. |
| JsonParser | Represents an event-based parser reads JSON data from a stream. |
| JsonGenerator | Writes JSON data to a stream one value at a time. |
| Name | Description |
|---|---|
| Json | Contains static methods to create JSON parsers, generators, and their factories. |
| JsonObjectBuilder | Creates an object model in memory by adding values from application code. |
| JsonArrayBuilder | Creates an array model in memory by adding values from application code. |
| JsonReader | Reads a JsonObject or a JsonArray from an input source. |
| JsonWriter | Writes a JsonObject or a JsonArray to an output source. |
Check out complete tutorials and examples of the JSON-P library at Java JSON Processing Tutorial.
References
Continue Learning with Java Guides
Want to take your programming skills to the next level? Explore my practical Udemy courses on Java, Spring Boot, Microservices, Full-Stack Development, Docker, and Generative AI. You can also follow my structured learning roadmaps to become a professional developer.
By Ramesh Fadatare - Udemy Instructor Partner

Comments
Post a Comment
Leave Comment