Live data from Hacker News

FracturedJson

github.com

91–100 of 173 posts

Re: FracturedJson

#91
post #4

Is there an option for it to read the contents from a pipe? that's by far my biggest use for the jq app.

I don't know, but you can always use <() process substitution to create a temp file.

Re: FracturedJson

#92
post #14

Earlier quoted context omitted.

I just built a C++ formatter that does this (owned by my employee, unfortunately). There's really only two formatting objects: tab-aligned tables, and single line rows. Both objects also support a right-floating column/tab aligned "//" comment. Both objects desugar to a sequence of segments (lines). The result is that you can freely mix expression/assignment blocks & statements. Things like switch-case blocks & macro…

You built it, but your employee owns it? That sounds highly unusual.

Autocorrect — employer. Too late to change, now!

Re: FracturedJson

#93
post #27

Earlier quoted context omitted.

We stopped having this problem over ten years ago when spec 1.1 was implemented. Why are people still harking on about it?

Because there's a metric ton of software out there that was built once upon a time and then that bit was never updated. I've seen this issue out in the wild across more industries than I can count.

I’m not here clanking down on Java for lacking Lambda features, the problem is that I did not update my Java environment past the 2014 version, not a problem with Java.

Re: FracturedJson

#94
post #4

Is there an option for it to read the contents from a pipe? that's by far my biggest use for the jq app.

You can (usually) specify the input file name as “-“ (single hyphen) to read from stdin

Or you can use `/dev/stdin`, which has the upside of not needing tool support.

I somewhat regularly use this on Linux. I think it also works on OS X

Re: FracturedJson

#95

I made a silly groovy script called "mommyjson" that doesn't try to preserve JSON formatting but just focuses on giving you the parentage (thus the name) including array indexes, object names, etc., all on the same line, so that when you find something, you know exactly where it is semantically. Not gonna claim that everybody should use it or that it cures insomnia cancer & hangnails, but feel free to borrow it: http…

This is good! There are a number of these, so it seems like it's definitely somthing people want. The most popular of which I think is gron[0]. My own is jstream[1]. One tiny point of friendly feedback: you may want to consider adding an example usage/output so folks can see what it does literally.

[0] - https://github.com/tomnomnom/gron [1] - https://github.com/ckampfe/jstream

Re: FracturedJson

#96
post #27

Earlier quoted context omitted.

This is a reference to YAML parsing the two letter ISO country code for Norway: country: no As equivalent to a boolean falsy value: country: false It is a relatively common source of problems. One solution is to escape the value: country: “no” More context: https://www.bram.us/2022/01/11/yaml-the-norway-problem/

We stopped having this problem over ten years ago when spec 1.1 was implemented. Why are people still harking on about it?

A new spec version doesn’t mean we stop having the problem.

E.g. kubernetes wrote about solving this only five months ago[1] and by moving from yaml to kyaml, a yaml subset.

[1]: https://kubernetes.io/blog/2025/07/28/kubernetes-v1-34-sneak...

Re: FracturedJson

#97

Earlier quoted context omitted.

The Norway issue is a bit blown out of proportion seeing as the country should really be a string `"no"` rather than the `no` value

Yeah, but it's a fun slogan. My real peeve is constantly getting the spaces wrong and no tooling to compensete for its warts. If there were linters and test frameworks and unit tests etc for yaml, I'd just sigh and move on. But current situation is, for instance in ADO Yaml: "So it's time to cut a release and time is short - we have a surprise for you! This will make some condition go true which triggers something no…

> If there were linters

Available and kept up-to-date. I found for Python, PHP:

https://github.com/j13k/yaml-lint

https://github.com/adrienverge/yamllint

Also .net:

https://github.com/aaubry/YamlDotNet

And NPM/js:

https://github.com/stoplightio/spectral

Re: FracturedJson

#98

I made a silly groovy script called "mommyjson" that doesn't try to preserve JSON formatting but just focuses on giving you the parentage (thus the name) including array indexes, object names, etc., all on the same line, so that when you find something, you know exactly where it is semantically. Not gonna claim that everybody should use it or that it cures insomnia cancer & hangnails, but feel free to borrow it: http…

do you have an ouput example?

Re: FracturedJson

#99
post #17

It looks like there are two maintained implementations of this at the moment - one in C# https://github.com/j-brooke/FracturedJson/wiki/.NET-Library and another in TypeScript/JavaScript https://github.com/j-brooke/FracturedJsonJs . They each have their own test suite. There's an older pure Python version but it's no longer maintained - the author of that recently replaced it with a Python library wrapping the C# code…

Data driven test suites are really good for building trust in a library. Both the html5lib-tests suite and my recent xss-bench are examples of this!

Re: FracturedJson

#100

Earlier quoted context omitted.

You can (usually) specify the input file name as “-“ (single hyphen) to read from stdin

Or you can use `/dev/stdin`, which has the upside of not needing tool support. I somewhat regularly use this on Linux. I think it also works on OS X

And conversely, `/dev/stdout` (resp. `/dev/stderr`) is a convenient way to "redirect" output to stdout (resp stderr) instead of a file
Post reply on HN