Support for JSONC (JSON with Comments)

0 votes
asked Jan 11, 2023 in Wanted features by omerigon (120 points)

Today it is not possible to use Support for JSONC (JSON with Comments).

For example, the below results in an error:

@startjson
{
  "firstName": "John",
  "lastName": "Smith",
  "isAlive": true, // True when alive
}
@endjson
commented Jan 11, 2023 by The-Lu (64,760 points)

Here is only a minor remark:

Without the last comment, beware to the last comma:

Compare:

@startjson
{
  "firstName": "John",
  "lastName": "Smith",
  "isAlive": true,
}
@endjson

and:

@startjson
{
  "firstName": "John",
  "lastName": "Smith",
  "isAlive": true
}
@endjson

Regards.

commented Jan 12, 2023 by Todd Musheno (2,680 points)
Agreed, but the comment still does not show up.

2 Answers

0 votes
answered Jan 13, 2023 by plantuml (295,000 points)
Do you expect PlantUML to simply ignore comments (that is, ignore 'True when alive') ?

Or do you expect PlantUML to put a note on "isAlive" ?
commented Jan 19, 2023 by The-Lu (64,760 points)
edited Jan 19, 2023 by The-Lu

Hi all,

Perhaps the both, depending of a global flag or a global parameter.... (to avoid printing a comment when it is not necessary)...

Then for the development:

  • 1. First accept JSONC and ignore comment
    Now implemented yes:
@startjson
{
  "firstName": "John",
  "lastName": "Smith",
  "isAlive": true // True when alive
}
@endjson

  • 2. Then accept JSONC and print comment (or not depending of a flag/param)...

FYI, I update also:

Regards.

+2 votes
answered Feb 21, 2023 by anonymous

JSON Comments are not part of the standard. https://datatracker.ietf.org/doc/html/rfc8259

Should really be worked through IETF standards process for industry compatibility.

...