Comments (9)
@avisser It would be nice not having to escape it but the JSON simply needs to be valid after the arguments have been processed by the shell, so it's unfortunately necessary. Otherwise it would require an error-correcting JSON parser to allow unquoted strings.
You can also wrap the whole argument with single quotes ('purchased_licenses:=["android.test.purchased"]'
), or It might be easier to pass the JSON in via stdin
, such as:
echo '{"purchased_licenses": ["android.test.purchased"]}' | http localhost:8888/api/learn/license_check
# or from a file
http localhost:8888/api/learn/license_check @payload.json
(Tip: POST
is default here because you are sending data with your request so you can omit it.)
from httpie.
I was worried that might be the case. Thanks for the alternatives.
Might I suggest using one of your examples in the readme.rst?
The fact that
blah:=[1,2,3]
and
blah:=["1","2","3"] #the quotes get stripped, but bare numerals are fine
both work drove me crazy for a few minutes.
Great utility. Keep up the good work.
from httpie.
Good idead, I'll update the README. Cheers
from httpie.
Still getting below error when i pass with quotes from cmd line 'meals:=["ham", "spam"]' (i notice in the documentation you use = and not := though I tried both)
http-script.py: error: argument REQUEST ITEM: "spam]'" is not a valid value
from httpie.
to pass string arrays in json from cmd line, i found the below option working:
meals:=["ham","spam"]
thanks btw for this great project.
from httpie.
It looks like your shell is eating the quotes for some reason. The first form works fine in bash:
from httpie.
meals:='["ham","spam"]' with (or without) quotes doesn't work on windows cmd. I have to use '' escapes.
from httpie.
I misread you comments, but have corrected my answer in the meantime. Sorry for the confusion.
Okay, I understand, there is this nested quoting incompatibility between bash and cmd.exe. I will update the docs accordingly. Thanks.
from httpie.
Hello.
I have just installed httpie and I am trying to perform some aggregate queries on a data base on my local machine. I got the error message;
http-script.py: error: argument REQUEST_ITEM: "[" is not a valid value
What can I do to resolve this? I have tried several options but no success. Below I attach a screenshot of my console
from httpie.
Related Issues (20)
- Trim trailing empty lines from CLI output HOT 1
- Cryptographic API Misuse Vulnerability : Missing SSL Certificate Validation HOT 1
- 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
- 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:
- I got [reports](https://github.com/RageAgainstThePixel/OpenAI-DotNet/issues/236) that this started happening today:
- ## Acceptance Criteria
- it is not possible install for arm linux HOT 3
- Please add support for Mise
- conda-forge lists __win as a MatchSpec dependency for httpie=2.2.0 preventing installation on linux-64 HOT 1
- Failed to use {{key}}={{value}} for nested JSON HOT 1
- Online doc error HOT 3
- Ability to define a custom default user-agent in config.json
- Add .netrc support when using --auth-type bearer
- unable to CONTRIBUTING
- ### Summary
- server HOT 1
- CLI help doesn't show how to launch in a browser!
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 httpie.