0

Sorry for my naive question, I am looking for some tools that would automatically convert JSON objects (that are generated in swagger UI) to a Java class objects in Eclipse.

Are there any such tools or plugins that can integrate swagger code with Eclipse Java and Groovy Grails framework. It would save a lot of time by not rewriting a huge amount of Java code every time when I want to change something in JSON objects.

mGm
  • 264
  • 2
  • 12
  • Possible duplicate of [How to convert the following json string to java object?](https://stackoverflow.com/questions/10308452/how-to-convert-the-following-json-string-to-java-object) – user1766169 May 30 '18 at 06:56

3 Answers3

1

I suggest to use autorest tool to generate code and models. It supports multiple languages including Java. Here is the github repository autorest

Just follow simple steps-

  1. npm install -g autorest
  2. autorest --input-file=https://******url******/swagger/v1/swagger.json --java --namespace=****namespace*****
Krishna Varma
  • 4,238
  • 2
  • 10
  • 25
0

You can use Google Gson Library in java.

Duong Anh
  • 529
  • 1
  • 4
  • 21
0

You could use that or Groovys JSONsluprer but I depending on what you're trying to achieve it might just be easiest if you have a swagger to start with swagger codegen https://github.com/swagger-api/swagger-codegen tools and have it make those for you. If not you can always look to investigate how they did it.

dawogfather
  • 604
  • 5
  • 10