Some Advanced Notecard Configuration Examples don't work

I was trying out some of the JSON examples in the Advanced Notecard Configuration documentation and some were giving me errors. I realized that it was due to comments being used in the JSON.

e.g

{
“req”: “card.io”,
“i2c”: 24 // 0x18
}
{
“err”: “cannot interpret JSON: string or ‘}’ expected near end of file {io}”
}

and

{
“req”: “card.aux”,
“mode”: “gpio”,
“usage”: [
“off”, // AUX1
“low”, // AUX2
“high”, // AUX3
“input” // AUX4
]
}
{
“err”: “cannot interpret JSON: string or ‘}’ expected near end of file {io}”
}

If I remove the comments, the code will work. Is there some preprocessor missing to strip the comments? Or are comments not allowed?

Hi @ralphjy,

Comments are not allowed in JSON, and at the moment and we don’t have any preprocessor that strips them.

This is good feedback, as I can totally see myself getting confused by the same thing, so I’ll see what I can do to make the docs more clear.

Thanks,
TJ