https://github.com/rvguradiya/jackson-explorer
Explore the power of Jackson for JSON processing in Java. Includes examples of object serialization, deserialization, tree model usage, and Streaming API for memory-efficient JSON handling.
https://github.com/rvguradiya/jackson-explorer
Last synced: about 2 months ago
JSON representation
Explore the power of Jackson for JSON processing in Java. Includes examples of object serialization, deserialization, tree model usage, and Streaming API for memory-efficient JSON handling.
- Host: GitHub
- URL: https://github.com/rvguradiya/jackson-explorer
- Owner: rvguradiya
- License: mit
- Created: 2025-01-23T10:45:07.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-01-23T11:42:03.000Z (4 months ago)
- Last Synced: 2025-02-05T20:07:48.532Z (4 months ago)
- Language: Java
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Jackson Explorer
A Java project to explore the capabilities of the **Jackson library**, including:
- Object-to-JSON serialization
- JSON-to-Object deserialization
- Tree model usage for dynamic JSON handling
- Memory-efficient JSON parsing/generation using the Streaming API## Project Details
- **Group ID**: `com.practice`
- **Artifact ID**: `jackson-explorer`
- **Version**: `1.0-SNAPSHOT`## Prerequisites
- **Java Version**: `1.6` or later
- **Maven**: `3.6.0` or later## Setup and Build
1. Clone this repository:
```bash
git clone https://github.com/rvguradiya/jackson-explorer.git
```
2. Navigate to the project directory:
```bash
cd jackson-explorer
```
3. Build the project using Maven:
```bash
cd jackson-explorer
```
## Running the Project1. Clone this repository:
```bash
mvn compile exec:java -Dexec.mainClass="com.practice.App"
```
2. Navigate to the project directory:
```bash
mvn clean dependency:copy-dependencies package
java -cp target/jackson-explorer-1.0-SNAPSHOT.jar:target/dependency/* com.practice.App
```## Key Features
- **ObjectMapper Usage**: Convert Java objects to JSON and vice versa.
- **Generic Methods**: Generic methods to handle different types of JSON serialization/deserialization.
- **Tree Model**: Extract dynamic fields from JSON using JsonNode.
- **Streaming API**: Parse and generate JSON in a memory-efficient way.## Example Code
### Object to JSON Example
```java
Person person = new Person("John Doe", 30);
JacksonExample.convertToJSON(person);
```
### JSON to Object Example
```java
JacksonExample.convertToObj("{\"name\":\"John\",\"age\":30}", Person.class);
```
## License
This project is licensed under the MIT License.