24 ms·
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: $
by jkbr 5y ago
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 https://httpie.io/blog/httpie-3.0.0
[1] https://httpie.io/docs/cli/nested-json https://httpie.io/docs/cli/nested-json
- timwis 5y agojo immediately reminded me of httpie’s CLI syntax. Is it just a coincidence, or does httpie use jo under the hood? Btw loving your new desktop app so far!
- jkbr 5y agoWe did look at `jo`, and also `jarg`[0], the W3C HTML JSON form syntax[1], and pretty much every other approach we could find. We had quite a few requirements that the new nested syntax had to meet: be simple/flexible, easy to read/write, backward/forward compatible, and play well with the rest of the HTTPie request language. The final syntax is heavily inspired by the HTML JSON forms one. But we made it stricter, added type safety, and some other features. It also supports all the existing functionality like embedding raw JSON strings and JSON/text files by paths. The final implementation[2] is completely custom. We have plans to ship it as a standalone tool as well, publish the test suite in a language-independent format and write a formal spec so that other tools can easily adopt it. This spec will eventually be a subset of one for the overall HTTPie request language, which is currently tied to our CLI implementation but we want to decouple it. Happy to hear you like the desktop app! [0] https://github.com/jdp/jarg https://github.com/jdp/jarg [1] https://www.w3.org/TR/html-json-forms/ https://www.w3.org/TR/html-json-forms/ [2] https://github.com/httpie/httpie/blob/master/httpie/cli/nested_json.py https://github.com/httpie/httpie/blob/master/httpie/cli/nest... — this is the path parser
- timwis 5y agoThanks for the detailed reply! Hadn’t come across the HTML JSON form syntax before. Good to know memorising the httpie request language will have some side benefits in that it’s closely related to a standard in use elsewhere.