Skip to content
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

Feature request: Quick way to set nested JSON values #346

Closed
BrandonY opened this issue Apr 29, 2015 · 4 comments
Closed

Feature request: Quick way to set nested JSON values #346

BrandonY opened this issue Apr 29, 2015 · 4 comments
Labels
duplicate Issue already exists enhancement New feature or enhancement

Comments

@BrandonY
Copy link

Let's say an API takes several values, like in this example call:

{
   "name": "Fred",
   "age", 27,
   "pets" : {
      "penguins": 2,
      "dogs":1
   }
}

I can reference name and age easily:

$> http PUT https://www.example.com/users/1  name=Phil age=25

But editing pets is uglier:

$>   http PUT https://www.example.com/users/1 pets:='{"penguins":2, "dogs":1}'

I'd like to do something like one of these:

$> http PUT https://www.example.com/users/1 pets.penguins=2  pets.dogs=1
$> http PUT https://www.example.com/users/1 pets="penguins=2 dogs=1"
$> http PUT https://www.example.com/users/1 pets\penguins=2 pets\dogs=1

That said, "." and "" could conceivably be part of a JSON key, so maybe that's not actually a good idea?

@matleh
Copy link

matleh commented Jun 1, 2015

Maybe have a look at JSONPath (http://goessner.net/articles/JsonPath/) for syntax inspiration.

@sigmavirus24
Copy link

Duplicate of #78

@jkbrzt jkbrzt added duplicate Issue already exists enhancement New feature or enhancement labels Jun 26, 2015
@jkbrzt
Copy link
Member

jkbrzt commented Jun 26, 2015

Closing this in favor of #78

@jkbrzt jkbrzt closed this as completed Jun 26, 2015
@isidentical
Copy link
Contributor

🎉 This feature is now publicly available in HTTPie for Terminal 3.0:

👉🏻 https://httpie.io/docs/cli/nested-json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issue already exists enhancement New feature or enhancement
Projects
None yet
Development

No branches or pull requests

5 participants