0

Let's say I have a JSON schema like below

{
"title": "Example Schema",
"type": "object",
"properties": {
    "firstName": {
        "type": "string"
    },
    "lastName": {
        "type": "string"
    },
    "age": {
        "description": "Age in years",
        "type": "integer",
        "minimum": 0
    }
},
"required": ["firstName", "lastName"]
}

Is there any API in Java that can convert this schema to an actual Json object provided I input random values to the "firstname" and "lastname"?

Damien-Amen
  • 7,232
  • 12
  • 46
  • 75
  • do you mean u want to convert String to JSON? – nafas Feb 09 '16 at 16:57
  • @nafas: No, it's not converting a string to JSON. I know it can be done by `JSON.parse(jsonString)` But this is about converting a json schema to an actual json object or a string – Damien-Amen Feb 09 '16 at 17:04
  • 2
    Are you looking for something like this: http://www.jsonschema2pojo.org/ – EdgeCase Feb 09 '16 at 17:09
  • @EdgeCase : Exactly something like that. Yes! But that converts the schema to a Java POJO class. I just need the json String or object. Do you know how to get it? – Damien-Amen Feb 09 '16 at 17:11
  • @Damien-Amen Have you found any solution for this? I need the exact same thing. – NIrav Modi Dec 26 '18 at 07:57
  • Is anyone found solution for this ?I need the same thing.I have a very complicated json schema which i need to convert into the json object.Manually if I modify it that will take a lot of time. – shaleen madlapure Jul 03 '20 at 05:05

0 Answers0