Tools, FAQ, Tutorials:
JSON Type Definitions and References
How to define a JSON type and reference it in JSON Schema?
✍: FYIcenter.com
If you want to define a JSON type, and reference it later in your JSON Schema,
you can:
1. Name your JSON type can put it inside the "definitions" property. For example, "rating" as a JSON type can be defined as shown below:
{
"definitions": {
"rating": {
"type": "integer",
"minimum": 0,
"maximum": 5
}
},
...
}
2. Use "$ref" instead of "type" property to refer to a previously defined JSON type. For example, the following JSON schema defines a JSON Object that should have two properties with the same JSON type "rating":
{
...
"type": "object",
"properties": {
"clarity": {
"$ref": "#/definitions/rating"
},
"efficiency": {
"$ref": "#/definitions/rating"
}
}
}
⇒ References to JSON Types Defined Externally
2017-08-25, ∼2291🔥, 0💬
Popular Posts:
How to convert JSON Objects to PHP Associative Arrays using the json_decode() function? Actually, JS...
How to detect errors occurred in the json_decode() call? You can use the following two functions to ...
How to use the RSS Online Validator at w3.org? You can follow this tutorial to learn how to use the ...
How to register and get an application ID from Azure AD? The first step to use Azure AD is to regist...
How to install "The Windows SDK version 8.1"? I need to build my Visual Studio C++ applications. If ...