Search code examples
javaandroidjsonretrofit2pojo

Easy way to convert complex json to simple POJO files for Android


I'm trying to convert complex json response to simple POJO objects. What I mean, I can convert this json response to pojo with www.jsonschema2pojo.org , but it generates me 47 files. I don't want this solution.

I want simple and light POJO objects. So, what I need, a few pojo files (May be max 5-6 files) with entire json attributes.

Example

My sample json response ( Wordpress ): https://pastebin.ca/3855759

And the generator creates these files: see image

I read these and similar posts but I could't fix my issue;

stackoverflow.com/questions/41692991/convert-nested-json-to-simple-json stackoverflow.com/questions/31117784/convert-complex-json-to-one-level-pojo-using-jackson

So, do you have any solution to accomplish this?


Solution

  • try GSOnFormat plugin from in android studio plugins. you can install it from file >Settings>plugins>browse repository>GSONFORMAT

    use it using alt+insert