JSON comments

This is not allowed:

{
    //some variable
    "foo": "bar":"
}

But this is allowed:

{
    "//": "some variable",
    "foo": "bar"
}

What about multiple lines? This is not allowed:

{
    "//": "some variable",
    "foo": "bar",
    "//": "some other variable",
    "name": "Peter"
}

But how about this:

{
    "// 1": "some variable",
    "foo": "bar",
    "// 2": "some other variable",
    "name": "Peter"
}

Or this:

{
    "/**": "",
    " * 1": "This is a multiline comment description",
    " * 2": "of a variable",
    "**/": "",
    "name": "Peter"
}

What about multiple multiline comments? You already can guess it:

{
    "/** 1": "",
    " * 1.1": "This is a multiline comment description",
    " * 1.2": "of a variable",
    "**/ 1": "",
    "name": "Peter",
    "/** 2": "",
    " * 2.1": "This is a multiline comment description",
    " * 2.2": "of a variable",
    "**/ 2": "",
    "age": "23"
}

Not very pretty but it serves it’s purpose.

I discovered this by looking into Angular source code, take a look at their package.json:

{
    ...
    "scripts": {
        "/": "",
        "// 1": "Many developer of our checks/scripts/tools have moved to our ng-dev tool",
        "// 2": "Find the usage you are looking for with:",
        "// 3": "yarn ng-dev --help",
        "/ ": "",
        ...
}