1. 33
  1. 12

    I’m not a huge fan of learning another weird DSL for working with json – I can barely keep enough of jq in my head. There’s basically a zero percent chance I’ll be able to write things like --jp ":list Monday, Tuesday, Wednesday, Thursday" without looking them up the once in a blue moon that I need them.

    1. 3

      This is one of my favorite things working in xonsh, I can do all my JSON. Using obvious python notation and have it just work with curl et al

      1. 1

        jq for receiving and curl for sending!

        Curl’s JSON is only for generating the request body, something which isn’t easy to do with jq (right?)

        1. 1

          jq can manipulate data. I’d rather just one tool.

      2. 7

        Exciting to see builtin JSON support on the way, although I’m probably going to stick to xh (like HTTPie but in Rust) as it’s really easy to add JSON data, query parameters, headers, etc.

        1. 1

          Nice.

          I had just learned about HTTPie, but was bummed to read it’s Python based. Figured there’s a Rust alternative.

        2. 4

          a) having an option to just push to stdout instead of forming a request would allow inspection + iteration more easily as well as making it generally more useful

          b) having a seperate tool which only wrote to stdout seems almost nicer. Call it ‘qj’ as the opposite of ‘jq’, and you then have:

          qj | curl | jq

          with the curl command using the “read json from stdin, set headers approprirately” option outlined in the doc.

          1. 7

            The article reference jo, which seems to be what you want.

            1. 2

              Thank you, I missed the reference.

              1. 1

                Thank you, this is great!

            2. 3

              Ah OK so this is really a tool to make handling JSON encoding the right way in HTTP requests easier, right? I know I’ve gotten it wrong a bunch myself :)

              1. 3

                I wouldn’t want to learn a new language. But I do think it’s worth allowing JSON5 as input instead of JSON. Especially since JSON5 is a superset, so there’s no incompatibility. Using JSON5 makes sense for the command line to alleviate the amount of escaped double-quotes.

                1. 2

                  This doesn’t take JSON as input! It emits JSON (and, as such, of course shouldn’t emit a superset).