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 cli.
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 cli.
Good idead, I'll update the README. Cheers
from cli.
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 cli.
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 cli.
It looks like your shell is eating the quotes for some reason. The first form works fine in bash:
from cli.
meals:='["ham","spam"]' with (or without) quotes doesn't work on windows cmd. I have to use '' escapes.
from cli.
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 cli.
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 cli.
Related Issues (20)
- Support for team collaboration/sync HOT 3
- Average speed is reported incorrectly for resumed downloads HOT 1
- How to remove DEFAULT_UA? HOT 1
- Default to localhost HOT 2
- Allow XDG_CONFIG_HOME usage also on Windows
- More statuses support HOT 1
- Unable to install httpie via Chocolatey HOT 14
- [macOS] Lag when piping stdout HOT 5
- Display a warning for using option --ignore-stdin when request fails with content present in stdin
- Request is fired to packages.httpie.io on every invocation of `http` HOT 1
- How to post an empty string as a data field? HOT 2
- werkzeug compatibility
- Docs: Ubuntu/Debian installation script gives error
- Does not work with a small easy peasy sample 'http -f requests.http' HOT 4
- Add shortcut to --verify=no
- Default headers by domain
- Add support for OAuth2 authentication
- Can't install a plugin because cannot invoke pip
- HTTPS_PROXY not working
- Hash character `#` in a query string causes the rest of the string to be ignored HOT 2
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.