bazelbuild / starlark

Starlark Language
Apache License 2.0
2.44k stars 163 forks source link

Support JSONC in json module #255

Open ashi009 opened 1 year ago

ashi009 commented 1 year ago

Description of the feature request:

It would be great to support JSONC format in json module.

json.decode(str, allow_comments = True)

or

jsonc.decode(str)

What underlying problem are you trying to solve with this feature?

With the adoption of bzlmod, and https://github.com/bazelbuild/bazel/issues/14632. Maintaining all the extension configs in MODULE.bazel becomes harder and harder.

Therefore, as a rule author, I'd love to provide a way for users to offload such configs in a separate file. And most importantly I want this file to be somewhat ergonomic to work with. For now, the only natively supported data format is JSON. However, JSON is not a great format for human maintained data, where comments and trailing commas are appreciated. On the other hand, JSONC solves those issues perfectly while not introducing lots of complexity to the parser.

Which operating system are you running Bazel on?

macOS

What is the output of bazel info release?

6.2.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

stepancheg commented 1 year ago

This is a repo for starlark spec, not specific starlark implementation (even if this repo sits in bazel org).