New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syntax for nested JSON #78
Comments
For deeply nested JSON it's easier to use
More examples are listed in the README. |
httpie is a dream! nesting would make it even more awesome though. It would be nice with rails-like nesting, e.g. |
Some sort of easier syntax for nested data would really be a nice thing to have. |
So nesting could be expressed either with brackets or using dot notation. |
Greetings!!! Small question regarding nested json and httpie. So I have a json file:
I want to increase the value of Using just
...however using it TOGETHER with Thanks!!!! |
Answering my own question: http -v PUT http://10.10.10.219:8080/v2/apps/product/web/tutum-hello-world-1 instances:=2 constraints:='[["hostname", "LIKE", server1.localnet.nett"]]'
Thanks!! Alex |
@jkbrzt For clarification are you referencing jarg for your own notes/feature development? I tried the following which didn't work:
Is received as:
However, piping through jarg does seem to work:
Is received as:
|
@lastcoolnameleft yes, I was just bookmarking that spec. Sorry for the confusion. |
Hi, I am not sure to understand, how do you provided nested json object with Httpie |
I would prefer javascript compatible syntax, so |
any updates on this issue? |
agree that this would be very welcome. |
@jakubroztocil This issue has been open for 6 years! And it is such a rudimentary feature! Of course, we can all do |
I don’t think it’s that simple, or someone would have sent a pull request! We should appreciate projects written on free time and given for free. |
@merwork We appreciate it. But how many REST services you know to have only a flat JSON? |
Many that I write :) Thanks for the pointers to jarg and jo! Goes well in my json toolbox with jq and gron. |
If you don't like piping JSON from https postman-echo.com/post @<(jo hello=world) It would still be much better if HTTPie supported a syntax like those tools of course. |
An important consideration here is backwards compatibility. If we simply introduce a syntax relying on dots, than a script containing the following HTTPie command: $ http httpbin.org/post foo.bar=baz Which currently produces this JSON: {
"foo.bar": "baz"
} Would unexpectly result in: {
"foo": {
"bar": "baz"
}
} So the command would have to be updated to escape the newly-meanignful $ http httpbin.org/post 'foo\.bar=baz' |
+1 for the compat issue, but the proposed solution should be more complicated: $ http httpbin.org/post "foo\.bar=baz" otherwise the shell escape |
@merwok Good point. I’ve updated the example to take shell escaping into account. General request item escaping rules apply. |
Note that since HTTPie 2.5.0, you can use $ http pie.dev/post --raw '{"foo": {"bar": "baz"}}' {
"foo": {
"bar": "baz"
}
} |
🎉 This feature is now publicly available in HTTPie for Terminal 3.0: |
The simple examples work, but what about nested data?
In curl I do something like this:
-d
'"credentials": {
"username": "me",
"key": "my-key"}
}'
How can I do this with httpie?
The text was updated successfully, but these errors were encountered: