jsonschema - Create JSON schema based on a json object -


given following json object, how can build json schema? product1, product2 , product3 dynamic "keys" , have many more that, each of them have same "value" object required keys packageid1, packageid2, packageid3 , corresponding values strings.

{   "product1": {     "packageid1": "basicpackage",     "packageid2": "basicpackage",     "packageid3": "basicpackage"   },   "product2": {     "packageid1": "newpackage",     "packageid2": "newpackage",     "packageid3": "newpackage"   },   "product3": {     "packageid1": "thirdpackage",     "packageid2": "thirdpackage",     "packageid3": "thirdpackage"   } } 

i think figured how it. in case interested, answering own question. also, welcome better suggestions.

{   "title": "json schema fulfillment config",   "$schema": "http://json-schema.org/draft-04/schema#",   "type": "object",   "patternproperties": {     ".{1,}": {       "type": "object",       "properties": {         "packageid1": { "type": "string" },         "packageid2": { "type": "string" },         "packageid3": { "type": "string" }       }     }   } } 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -