AND I love Java but creating the Java classes to serve or parse your JSON is a pain.
Especially when the JSON alters!
So use jsonschema2pojo!
It comes with a handy code generator Maven plugin.
The steps are as follows:
- Create a Java project with a maven POM;
- Add the code generator as seen in the documentation;
- Capture your JSON;
- Create the JSON schema in the folder specified in your POM using jsonschema.net;
- run mvn generate-sources;
Done!