Created
May 21, 2012 16:00
-
-
Save shishkin/2763023 to your computer and use it in GitHub Desktop.
JSON descriptors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"@": { | |
"id": "http://example.org/my-obj", | |
"description": "This object is described with an embedded descriptor. Other JSON-Schema properties may follow." | |
}, | |
"prop": "value" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "latte", | |
"@name": { | |
"type": "string", | |
"options": ["latte", "espresso", "americano", "cappucino"] | |
}, | |
"quantity": 1 | |
} |
JSON descriptors are similar to XML attributes, hence the @
prefix. They can even be used to add Microformats annotations to JSON data.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
JSON Descriptors are embedded pieces of JSON-Schema or other meta-information. There are two ways of embedding a descriptor in a JSON document:
Child Notation
Insert a child
@
attribute to describe the object itself.Sibling Notation
Insert a
@prop
attribute to describe its siblingprop
attribute.