Skip to content

Janaka2/Java-JSON-Conversion-Examples

Repository files navigation

Java-JSON Conversion Examples

This repository contains examples of various Java-to-JSON and JSON-to-Java conversions using the Jackson library. The examples demonstrate how to convert different Java types, such as primitive types, Strings, Dates, Arrays, Collections, Maps, and custom Java objects, to their JSON equivalents, and vice versa.

Dependencies

This project uses the Jackson library for JSON serialization and deserialization. Add the following dependency to your project:

Maven

com.fasterxml.jackson.core jackson-databind 2.13.0

Examples

The examples in this repository are organized into the following Java classes:

  • PrimitiveTypesExample.java: Contains examples of converting primitive types and their wrapper classes to JSON and vice versa.
  • StringExample.java: Contains examples of converting Strings to JSON and vice versa.
  • DateExample.java: Contains examples of converting java.util.Date objects to JSON and vice versa.
  • ArrayAndCollectionExample.java: Contains examples of converting Arrays and Collections (such as Lists and Sets) to JSON and vice versa.
  • MapExample.java: Contains examples of converting Maps (such as HashMaps) to JSON and vice versa.
  • CustomObjectExample.java: Contains examples of converting custom Java objects to JSON and vice versa.

License

Open to use

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages