Skip to content

Support converting JSON5 comments to JSON object fields #7

@aSemy

Description

@aSemy

Presently comments are discarded when reading data and and writing data out. This allows for full compatibility with plain-JSON, but it would be nice if comments were handled.

In plain-JSON a common workaround is to use //

{
  "//": "comment",
  "example": "value"
}

If comments occur within JSON5-objects this convention could be formalised for JSON5<->plain-JSON mapping. JSON5 comments would be converted to and from String-JsonPrimitives with a key of // (this would need to be unique)..

{
  // comment
  "example": "value"
}

When comments are not easily mapped to an object value (they're in arrays, or outside of an object) I'm not sure what can be done.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions