Samples

Visit our online Demo Parser and Formatter.

No commas or quotes for array values

[
    milk
    eggs
    beer
]

[milk eggs beer]

No commas or quotes for object pairs

{
    color: blue
    number: 12
    band: Beatles
}

Optional trailing commas

[ 1, 2, 3, ] 
{ color:red, align:left, }

Single-Line Comments

// This is an RJSON file
[ one two three ]names.
// Thanks for viewing!

In-Line Comments

[ one two three ] // This is an array of number names.

Multi-Line (Block) Comments

/* This is an RJSON file */
[ one two /* a comment */ three ] /* This is an array of numbers with a comment inside. */
/* Thanks for
viewing! */

Single Quotes

{ 'hello' : 'world' }
'You "quoted" me!'

Backtick Quotes

{ `hello` : `world` }
` Wow, this line has unescaped "quotes" and 'apostrophes'! `

Multiline Strings

[
    "Strings can \
span multiple lines."

    'They can either \
single, double, or backtick \
quotes.'
]

Example RJSON and Equivalent JSON for ambiguous value cases.

[
    // Notice that the key is a string but the value is a number
    {1:1}
    {"1": 1} 

    // Now the value is a string
    {1:'1'}
    {"1":"1"}

    // More examples of this.
    { true:true }
    { "true":true }

    { true:'true' }
    { "true":"true" }

    { null:null }
    { "null":null }

    { null:'null' }
    { "null":"null" }

    // Not advised, but no quotes are needed when escaping reserved characters (spaces, etc).
    hello\:worldly\,world
    "hello:worldly,world"
]


This site is StackEditPro enabled.