Hi All,
Since there can be JSON payloads without a root element as shown below, we
are in a process of generating the JSON schema for such payloads. Please
find the implementation details
eg 1:
*Input*:
[
"777925",
"732321"
]
*JSON schema:*
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"id" : "http://wso2jsonschema.org",
"title" : "root",
"type" : "array",
"items" : {
"id" : "http://wso2jsonschema.org/0",
"type" : "string"
}
}
eg 2:
*Input*:
[
{
"id": 0,
"species": "Capra hircus",
"name": "Goat"
},
{
"id": 1,
"species": "Panthera pardus",
"name": "Leopard"
},
{
"id": 2,
"species": "Equus zebra",
"name": "Zebra"
}
]
*JSON Schema:*
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"id" : "http://wso2jsonschema.org",
"title" : "root",
"type" : "array",
"items" : {
"id" : "http://wso2jsonschema.org/0",
"type" : "object",
"properties" : {
"species" : {
"id" : "http://wso2jsonschema.org/0/species",
"type" : "string"
},
"name" : {
"id" : "http://wso2jsonschema.org/0/name",
"type" : "string"
},
"id" : {
"id" : "http://wso2jsonschema.org/0/id",
"type" : "number"
}
}
}
}
Thanks,
Sohani
Sohani Weerasinghe
Software Engineer
WSO2, Inc: http://wso2.com
Mobile : +94 716439774
Blog :http://christinetechtips.blogspot.com/
Twitter : https://twitter.com/sohanichristine
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev