jsonschema-rs icon indicating copy to clipboard operation
jsonschema-rs copied to clipboard

json5

Open mcandre opened this issue 3 months ago • 3 comments

Hi,

Can we please get JSON5 support, so that we can benefit from convenient comment toggling?

mcandre avatar Oct 16 '25 21:10 mcandre

FYI: JSON schema itself has a dedicated $comment field intended for schema developer commentary.

eirnym avatar Oct 18 '25 09:10 eirnym

Nope.

I'm not taking about adding a brief description to the toplevel schema.

I'm talking about the ability to toggle comments for arbitrary lines of JSON. That essential engineering capability was banned in JSON by Crockford in a paranoid attenpt to keep data "clean." Very few serialization formats make that mistake. It's incredibly cumbersome to deal with JSON files for this reason. That's why JSON5 exists.

mcandre avatar Oct 19 '25 21:10 mcandre

The $comment field is defined for type definition, so you can place it anywhere and it can be arbitrarily long.

Additionally, schema extensible by default, so you can place the field almost everywhere.

I personally don't like both JSON and JSON5 formats and prefer safe YAML for schema and configuration files as possible because of readability for humans.

eirnym avatar Oct 20 '25 02:10 eirnym