Convert Java Map to/from JSON using Jackson

In this post we will see how to Convert Java Map to/from JSON using Jackson.For this we will be using the ObjectMapper.readValue and   ObjectMapper.writeValue

We will have a map with employee object for the conversion

Employee.java

1. Converting Java Map to JSON

Output – JavaMapToJson.json
A file will be created with the below contents

2. Converting JSON to Java Map

We will use the same file that was created in the above code to recreate the Map object.

Output

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn