Skip to content

Instantly share code, notes, and snippets.

@shishkin
Created May 21, 2012 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shishkin/2763023 to your computer and use it in GitHub Desktop.
Save shishkin/2763023 to your computer and use it in GitHub Desktop.
JSON descriptors
{
"@": {
"id": "http://example.org/my-obj",
"description": "This object is described with an embedded descriptor. Other JSON-Schema properties may follow."
},
"prop": "value"
}
{
"name": "latte",
"@name": {
"type": "string",
"options": ["latte", "espresso", "americano", "cappucino"]
},
"quantity": 1
}
@shishkin
Copy link
Author

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 sibling prop attribute.

@shishkin
Copy link
Author

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