I have a json schema in draft 04 format (http://json-schema.org/draft-04/schema#) which is used to define a configuration. These schemas are dynamically created based on use input.
I need to pass this json schema to a method which only accepts a kotlin class as parameter. Is there a way to convert this json schema to a kotlin data class?
Basically what I want is something similar to what www.jsonschema2pojo.org this does, but I want to create the class dynamically in the method call.
Sample schema:
{
"title": "Schema 1",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"description": "Age in years",
"type": "integer",
"minimum": 0
}
},
"required": ["firstName", "age"]
}