Live data from Hacker News

Jo – a shell command to create JSON (2016)

jpmens.net

11–20 of 100 posts

Re: Jo – a shell command to create JSON (2016)

#11
The more I work with JSON, the more I crave some kind of dedicated json editor to easily visualize and manipulate json objects, and to serialize / deserialize strings. This is especially the case with truly massive JSON objects with multiple layers of nesting. Anyway, cool tool that makes one part of the process of whipping up JSON a little less painful

Re: Jo – a shell command to create JSON (2016)

#14

The more I work with JSON, the more I crave some kind of dedicated json editor to easily visualize and manipulate json objects, and to serialize / deserialize strings. This is especially the case with truly massive JSON objects with multiple layers of nesting. Anyway, cool tool that makes one part of the process of whipping up JSON a little less painful

Add a json LSP to your editor, or use VS code which includes it natively: https://www.npmjs.com/package/vscode-json-languageserver Configure a json schema for the document you're editing and suddenly you get suggestions, validation, etc. as you type. It's pretty magical.

There's one for yaml too that works well in my experience: https://github.com/redhat-developer/yaml-language-server

Re: Jo – a shell command to create JSON (2016)

#15

Some time ago I wrote zsh helper [1] that uses jo to quickly construct complex JSON requests, mainly for testing and quering services from console. Paired with httpie [2] aliases [3] it produces concise APL-like syntax: POST https://httpbin.org/post test:=j`a=b c=`e=3` l=`*1 2 3`` Which translates to: http POST https://httpbin.org/post test:="$(jo a=b c="$(jo e=3)" l="$(jo -a 1 2 3)")" Or, in other words, sending POS…

HTTPie creator here. We’ve recently[0] added support for nested JSON[1] to the HTTPie request language, so you can now craft complex JSON request directly:

  $ http pie.dev/post test[a]=b test[c][e]:=3 test[l][]:=1
[0] https://httpie.io/blog/httpie-3.0.0

[1] https://httpie.io/docs/cli/nested-json

Re: Jo – a shell command to create JSON (2016)

#17

The more I work with JSON, the more I crave some kind of dedicated json editor to easily visualize and manipulate json objects, and to serialize / deserialize strings. This is especially the case with truly massive JSON objects with multiple layers of nesting. Anyway, cool tool that makes one part of the process of whipping up JSON a little less painful

I wrote something like this for emacs: a couple functions “fwoar/dive” and “fwoar/return” that let you navigate JSON documents in a two-pane sort of paradigm.

https://youtu.be/qbRNmk-malw

Re: Jo – a shell command to create JSON (2016)

#18

Does it suffer from the Norway problem?

I think you're thinking of YAML; JSON doesn't interpret "no" as a boolean. Scroll down here to see the JSON grammar: https://www.crockford.com/mckeeman.html

I actually think the "Norway problem" is a PEBKAC from users not learning the data format. But this tool may confuse some people or applications who don't know what a boolean, integer, float or string are, and try to mix types when the program reading them wasn't designed to. Probably the issue will come up whenever people mix different kinds of versions ("1", "1.1", "1.1.1" should be parsed as an int, float, and string, respectively)

Re: Jo – a shell command to create JSON (2016)

#19
>Bam! Jo tries to be clever about types and knows null, booleans, strings and numbers.

I'm very skeptical of this. If I put x=001979 in as a value I dont think I want you trying to guess if that's supposed to be an integer or a string.

This sounds like the Norway Problem waiting to happen.

Post reply on HN