یک دیکشنری JSON تو در تو با ۴۰ شهواژه مرتبط با JSON (استاندارد RFC 8259/ECMA-404) اینطور میتواند باشد:
{
"jsonOverview": {
"standard": {"rfc": "8259", "ecma": "ECMA-404"},
"types": ["string","number","integer","object","array","boolean","null"],
"literals": ["true","false","null"],
"encoding": "UTF-8",
"example": {"msg": "hello", "count": 3, "ok": true}
},
"syntax": {
"object": {"members": "name:value pairs", "uniqueNames": true},
"array": {"elements": "ordered values", "heterogeneous": true},
"string": {"quotes": "double", "escape": "\\", "unicode": "\\uXXXX"},
"number": {"minus": "-", "frac": ".digits", "exp": "e/E±"}
},
"schemaKeywords": {
"$schema": "
json-schema.org/draft/2020-1…",
"$id": "
example.org/schemas/demo.jso…",
"title": "Demo",
"description": "Nested JSON with 40 keywords",
"type": "object",
"properties": {
"user": {
"type": "object",
"required": ["id","email"],
"properties": {
"id": {"type": "integer", "minimum": 1},
"name": {"type": "string", "minLength": 1, "maxLength": 100},
"email": {"type": "string", "format": "email"},
"roles": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
},
"additionalProperties": false
},
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"sku": {"type": "string", "pattern": "^[A-Z0-9-]{4,}$"},
"qty": {"type": "integer", "minimum": 1},
"price": {"type": "number", "minimum": 0, "multipleOf": 0.01}
},
"required": ["sku","qty","price"]
},
"minItems": 1
}
},
"required": ["user","items"],
"allOf": [
{"$ref": "#/$defs/common"},
{"if": {"properties": {"promo": {"const": true}}}, "then": {"required": ["coupon"]}, "else": {"not": {"required": ["coupon"]}}}
],
"anyOf": [
{"properties": {"channel": {"const": "web"}}},
{"properties": {"channel": {"const": "mobile"}}}
],
"oneOf": [
{"properties": {"currency": {"const": "USD"}}},
{"properties": {"currency": {"const": "EUR"}}}
],
"$defs": {
"common": {
"type": "object",
"properties": {
"createdAt": {"type": "string", "format": "date-time"},
"updatedAt": {"type": "string", "format": "date-time"},
"metadata": {
"type": "object",
"propertyNames": {"pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,31}$"},
"additionalProperties": {"type": ["string","number","boolean","null"]}
}
}
}
},
"readOnly": false,
"writeOnly": false,
"deprecated": false,
"examples": [
{"user": {"id": 1, "email": "a@b.com"}, "items": [{"sku": "ABCD-1", "qty": 2, "price": 9.99}], "currency": "USD"}
]
}
}