-
jsonc
Golang (v1.13+) JSON5 preprocessor supporting comments, trailing comma, unquoted key/single-quoted string, hex number, trailing decimal point, literal newlines and more. (by adhocore)
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
rjson
"readable JSON" - JSON-compatible codec with a few tweaks to make it quicker to write and easier to read (by rogpeppe)
jsonc is a Golang package for parsing JSON data with comments- both single (//) and multiline (/* */). It also supports trailing commas at the end of array and object notations, and literal line feeds in string values.
json though ubiquitous message exchange format, is for the machines but less so for humans. So jsonc is a little attempt to improve a bit: eg- with comments it would be possible to neatly annotate the data, trailing commas allow for proper diff on json config files and literal multiline strings greatly facilities breaking a super long line. I plan to implement most of [JSON5](https://json5.org] spec over time specifically object keys without wrapping quotes and string values with single quotes. Feedbacks welcome.
Requiring users to fully load in all JSON as a []byte or a string is a big kick in the teeth. You ought to be able to stream it through an io.Reader. You should either implement your code as an io.Reader wrapper, or go ahead and just fork encoding/json (or some other JSON library) to implement your changes, like this one did.
As others have said, there's a ton of variations on this theme already on GitHub. You are welcome to write whatever code you want of course, but if it is a problem for you that this market is already saturated, well, do what you need to with that information. This is an example of an io.Reader wrapper. Though there is a performance case to be made for integrating it into a fork of a normal library, because a reader wrapper must parse the JSON, then the decoder has to parse the JSON. The wrapper can parse it "less" but it still has to run a state machine through it. Integrating it into the decoder means the parsing can be done once.
Related posts
-
JSON5 – JSON for Humans
-
🚀 'GET' API in API Maker
-
TySON: a native go library that lets you use TypeScript as an embedded configuration language without depending on Node or V8
-
is there a reason JXON.ahk accepts only Maps and not Class Objects?
-
I was about to write "they learned from nvidia" but copilot beat me to it lmao