Skip to content
Advertisement

Convert a JSON String to a HashMap

I’m using Java, and I have a String which is JSON:

JavaScript

Then my Map in Java:

JavaScript

I want to store all the data from the JSONObject in that HashMap.

Can anyone provide code for this? I want to use the org.json library.

Advertisement

Answer

In recursive way:

JavaScript

Using Jackson library:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement