Comments (3)
The linked docs section talks about embedding raw JSON. The :=
notation achieves that. It embeds the JSON snippet as is, here resulting in a nested array:
$ http --offline pie.dev/post hobbies:='["http", "pies"]'
{
"hobbies": [
"http",
"pies"
]
}
Here, however, we use =
, which embeds the value as a string:
$ http --offline pie.dev/post hobbies='["http", "pies"]'
{
"hobbies": "[\"http\", \"pies\"]"
}
Therefore, the docs is correct.
Please note there’s also explicit syntax for constructing nested JSON structures: https://httpie.io/docs/cli/nested-json
from cli.
The linked docs section talks about embedding raw JSON. The
:=
notation achieves that. It embeds the JSON snippet as is, here resulting in a nested array:$ http --offline pie.dev/post hobbies:='["http", "pies"]'
{ "hobbies": [ "http", "pies" ] }Here, however, we use
=
, which embeds the value as a string:$ http --offline pie.dev/post hobbies='["http", "pies"]'
{ "hobbies": "[\"http\", \"pies\"]" }Therefore, the docs is correct.
Please note there’s also explicit syntax for constructing nested JSON structures: https://httpie.io/docs/cli/nested-json
Sorry, but when I run the command
http --offline pie.dev/post hobbies:='["http", "pie"]'
It gives me an error
error:
'hobbies:=': Expecting value: line 1 column 2 (char 1)
Did I do something wrong? THX
from cli.
The linked docs section talks about embedding raw JSON. The
:=
notation achieves that. It embeds the JSON snippet as is, here resulting in a nested array:$ http --offline pie.dev/post hobbies:='["http", "pies"]'
{ "hobbies": [ "http", "pies" ] }Here, however, we use
=
, which embeds the value as a string:$ http --offline pie.dev/post hobbies='["http", "pies"]'
{ "hobbies": "[\"http\", \"pies\"]" }Therefore, the docs is correct.
Please note there’s also explicit syntax for constructing nested JSON structures: https://httpie.io/docs/cli/nested-jsonSorry, but when I run the command
http --offline pie.dev/post hobbies:='["http", "pie"]'
It gives me an error
error: 'hobbies:=': Expecting value: line 1 column 2 (char 1)
Did I do something wrong? THX
Update:
Try to run this code on my Debian VM, everything goes well
$ http --offline pie.dev/post hobbies:='["http", "pie"]'
POST /post HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 28
Content-Type: application/json
Host: pie.dev
User-Agent: HTTPie/3.2.1
{
"hobbies": [
"http",
"pie"
]
}
So it's might be an issue just relate to the Windows Powershell.
from cli.
Related Issues (20)
- Filter response keys before print result to the screen
- HTTPie could be lead to believe data was passed in stdin when it was not HOT 1
- httpie -d does not work with gzip compressed content HOT 1
- Add cli option to generate scriptable or compilable code, or a native executable, that performs the command wherein the option was included
- I got [reports](https://github.com/RageAgainstThePixel/OpenAI-DotNet/issues/236) that this started happening today: HOT 1
- I got [reports](https://github.com/RageAgainstThePixel/OpenAI-DotNet/issues/236) that this started happening today: HOT 1
- ## Acceptance Criteria HOT 1
- it is not possible install for arm linux HOT 4
- Please add support for Mise HOT 1
- conda-forge lists __win as a MatchSpec dependency for httpie=2.2.0 preventing installation on linux-64 HOT 2
- Failed to use {{key}}={{value}} for nested JSON HOT 1
- Ability to define a custom default user-agent in config.json
- Add .netrc support when using --auth-type bearer
- unable to CONTRIBUTING HOT 2
- ### Summary HOT 1
- server HOT 1
- CLI help doesn't show how to launch in a browser! HOT 1
- Automated dependency bump with the latest Deno modules HOT 1
- dnf install httpie not working on CentOS-STREAM9 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.