8

I'm sure someone has done this before: A co-worker went through the trouble of making a JSON schema which can be used to validate a JSON object; however, I am lazy, and just want to generate a "default" empty JSON object from the schema. Is there an easy way to do this?

I would like to do this in Java.

Failing this, is there a way to generate a Java class (NOT at run-time) based on this schema?

Muchas gracias, amigos.

Madmartigan
  • 392
  • 1
  • 3
  • 7

3 Answers3

7

How about "jsonschema2pojo"?

joelittlejohn
  • 11,321
  • 2
  • 37
  • 52
StaxMan
  • 108,392
  • 32
  • 202
  • 235
0

Try checking out Java from JSON. It lets you paste JSON in and get source and compiled Jars. There's also a standalone version.

jessebs
  • 511
  • 3
  • 14
0

You can try this : Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. Gson can work with arbitrary Java objects including pre-existing objects that you do not have source-code of.

http://code.google.com/p/google-gson/

RCB
  • 2,205
  • 2
  • 22
  • 49