-3

I have a requirement where I have to create java classes for probable JSON response. So basically if I have,

{ email: 'email', password: 'pass' }

I should create a java class like below,

class Credentials
{
    string email;
    string password;

    // getter / setters below...
}

...and then mapping can be done later. That's how it works generally.

What I want is do we have any utility that can automatically create java classes from the JSON response? So if I pass the JSON object data like,

{ email: 'email', password: 'pass' }

I should get a java file automatically created like above. Why I am asking this is because the JSON that I have is pretty complex, objects inside objects inside objects. So I wanted to see if my coding can be reduced by some time if I can get the java file generated directly.

Please let me know if there is anything like this available?

Thanks in advance.

WebNoob
  • 237
  • 6
  • 16

1 Answers1

-3

Use this if you're using Jackson : https://github.com/astav/JsonToJava

Samyak Jain
  • 95
  • 1
  • 3