Overview
JSON Content Rules (JCR) is a language for describing and testing the interchange of data in JSON [RFC7159] format used by computer protocols and processes. The syntax of JCR is not JSON but is "JSON-like", possessing the conciseness and utility that has made JSON popular.
As an example, the following JSON taken from RFC 7159:
{
"Image": {
"Width": 800,
"Height": 600,
"Title": "View from 15th Floor",
"Thumbnail": {
"Url": "http://www.example.com/image/481989943",
"Height": 125,
"Width": 100
},
"Animated" : false,
"IDs": [116, 943, 234, 38793]
}
}
can be described using JCR as:
{
"Image" : {
"Width" : 0..1280,
"Height" : 0..1024,
"Title" : string,
"Thumbnail" : {
"Url" : uri
"Width" : 0..1280,
"Height" : 0..1024,
},
"Animated" : boolean,
"IDs" : [ *:integer ]
}
}
or alternatively, using named rules to avoid some of the type repetition, as:
{
"Image" : {
width, height,
"Title" : string,
"Thumbnail" : {
"Url" : uri,
width, height
},
"Animated" : boolean,
"IDs" : [ *:integer ]
}
}
width = "Width" : 0..1280
height = "Height" : 0..1024
Specification
For more details read the latest specification at draft-newton-json-content-rules-06.txt.
JCR can also have co-constraints added to it via directives and annotations. These are described in draft-cordell-jcr-co-constraints-00.txt.
Implementations
A number of implementations are under development to verify the JCR syntax. These include:
Ruby jcrvalidator (Work in Progress)
C++ cl-jcr-parser (Work in Progress)
Get Involved
Like JCR and want to know more? Know of an implementation we can list? Need help making JCR work for you? Contact us at .