How to create JSON Schema for Name/Value structure?

Assuming your validator supports it you can use patternProperties.

For the schema…

{
  "title": "Map<String,String>",
  "type": "object",
  "patternProperties": {
    ".{1,}": { "type": "string" }
  }
}

…and the document…

{
    "foo":"bar",
    "baz":1
}

…the value of property foo is valid because it is a string but baz fails validation because it is a number.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)