Depends on the actual JSON format. In fact, you can simply create a custom Javabean class that conforms to the JSON format. Any fields in JSON can be displayed as String , Integer , Boolean , etc. Javabean Properties. Any arrays can be displayed as List properties. Any objects can be displayed as another Javabean attached property. This greatly facilitates further processing in Java.
Without an example JSON string from the side, it only guesses how it will look, so I cannot give a basic example here. But I already posted similar answers before this, you may find this useful:
- Convert JSON to Java
- Create Java class from JSON?
Gson also has a User Guide , you may also find it useful.
Balusc
source share