JSON5 language preview
1. Config with comments
line/block comments, unquoted keys, trailing commas
horizon-dark
{
// build configuration
name: "svelte-highlight",
version: "1.0.0",
/* feature flags */
features: {
fastMode: true,
legacy: false,
},
} atom-one-dark
{
// build configuration
name: "svelte-highlight",
version: "1.0.0",
/* feature flags */
features: {
fastMode: true,
legacy: false,
},
} github-dark
{
// build configuration
name: "svelte-highlight",
version: "1.0.0",
/* feature flags */
features: {
fastMode: true,
legacy: false,
},
} dracula
{
// build configuration
name: "svelte-highlight",
version: "1.0.0",
/* feature flags */
features: {
fastMode: true,
legacy: false,
},
} nord
{
// build configuration
name: "svelte-highlight",
version: "1.0.0",
/* feature flags */
features: {
fastMode: true,
legacy: false,
},
} github
{
// build configuration
name: "svelte-highlight",
version: "1.0.0",
/* feature flags */
features: {
fastMode: true,
legacy: false,
},
} 2. Numbers and literals
hex, floats, signs, Infinity and NaN
horizon-dark
{
hex: 0xDECAF,
float: -3.14,
leading: .5,
exponent: 6.022e23,
positive: +42,
infinity: Infinity,
notANumber: NaN,
nothing: null,
} atom-one-dark
{
hex: 0xDECAF,
float: -3.14,
leading: .5,
exponent: 6.022e23,
positive: +42,
infinity: Infinity,
notANumber: NaN,
nothing: null,
} github-dark
{
hex: 0xDECAF,
float: -3.14,
leading: .5,
exponent: 6.022e23,
positive: +42,
infinity: Infinity,
notANumber: NaN,
nothing: null,
} dracula
{
hex: 0xDECAF,
float: -3.14,
leading: .5,
exponent: 6.022e23,
positive: +42,
infinity: Infinity,
notANumber: NaN,
nothing: null,
} nord
{
hex: 0xDECAF,
float: -3.14,
leading: .5,
exponent: 6.022e23,
positive: +42,
infinity: Infinity,
notANumber: NaN,
nothing: null,
} github
{
hex: 0xDECAF,
float: -3.14,
leading: .5,
exponent: 6.022e23,
positive: +42,
infinity: Infinity,
notANumber: NaN,
nothing: null,
} 3. Strings and keys
single- or double-quoted strings and bare keys
horizon-dark
{
'single-quoted': 'hello',
"double-quoted": "world",
unquoted: "value",
nested: { a: 1, b: 2 },
list: ["GET", "POST", "PUT"],
} atom-one-dark
{
'single-quoted': 'hello',
"double-quoted": "world",
unquoted: "value",
nested: { a: 1, b: 2 },
list: ["GET", "POST", "PUT"],
} github-dark
{
'single-quoted': 'hello',
"double-quoted": "world",
unquoted: "value",
nested: { a: 1, b: 2 },
list: ["GET", "POST", "PUT"],
} dracula
{
'single-quoted': 'hello',
"double-quoted": "world",
unquoted: "value",
nested: { a: 1, b: 2 },
list: ["GET", "POST", "PUT"],
} nord
{
'single-quoted': 'hello',
"double-quoted": "world",
unquoted: "value",
nested: { a: 1, b: 2 },
list: ["GET", "POST", "PUT"],
} github
{
'single-quoted': 'hello',
"double-quoted": "world",
unquoted: "value",
nested: { a: 1, b: 2 },
list: ["GET", "POST", "PUT"],
}