A subset of YAML, no comments! (But use JSMin) Also see TOML

.c.f.

Though, oddly enough, not JavaScript.

No string in JavaScript can contain a literal U+2028 or a U+2029.

Placeholder Data

There is some JSON PlaceHolder Data here & here

TODO: I should implement some of the myself.

Comments

JSON can’t include comments, but you can pre-process with JSmin to remove them.

Install JSmin

brew install jsmin

Create some JSON with a comments

cat << EOF > ./jsonWithComments.json
{
  "My Beta":                "DEADBEEF2116aecbaefe18d98171e2c",  // This is a comment
  "My Commerce Nightly":    "6DEADBEEF771248cba6aff5f4c972c779",
  "My Commerce Test":       "DEADBEEFe7df43cfaad8fa81f2eaba39",
  "My Experience Nightly":  "DEADBEEFc5dd45ee8d52e0019f0752be",
  "My Experience Test":     "DEADBEEF34ec5133ab2df8adc22d0ae7", // Another (Illegal) comment
  "My Nightly":             "DEADBEEF7485072eada656d6125682f8",
  "My Test":                "DEADBEEF5c11a4990aad6cf8f1c476df"
}
EOF

cat ./jsonWithComments.json

JSON without comments

cat ./jsonWithComments.json | jsmin 

Make it pretty (again)

cat ./jsonWithComments.json | jsmin | python -mjson.tool 

Verification

Use python -mjson.tool for basic JSON verificationa and pretty printing.

Given:

/dev/null

cat /dev/null | python -mjson.tool
No JSON object could be decoded
echo $?
1

{}

echo "{}" | python -mjson.tool
{}
echo $?
0

{"aa": "bb", "bb": "cc"}

echo '{"aa": "bb", "bb": "cc"}' | python -mjson.tool
{
    "aa": "bb",
    "bb": "cc"
}
echo $?
0

{"aa": "bb", "bb": "cc",} with trailing comma

echo '{"aa": "bb", "bb": "cc",}' | python -mjson.tool
Expecting property name: line 1 column 25 (char 24)
echo $?
1

Usage