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
Incorrectly parsing JSON #574
Comments
Correct me if I'm wrong, but isn't a JSON object usually in the format {"key":"value"}? |
@poskadesign the command looks okay and it works for me in Bash. It could be some escaping issue if you use some other shell. $ http -v httpbin.org/post param1="a b c" param2=d jparam:='["test string"]' POST /post HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 61
Content-Type: application/json
Host: httpbin.org
User-Agent: HTTPie/0.9.9
{
"jparam": [
"test string"
],
"param1": "a b c",
"param2": "d"
} HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 568
Content-Type: application/json
Date: Sun, 14 May 2017 10:58:53 GMT
Server: meinheld/0.6.1
Via: 1.1 vegur
X-Powered-By: Flask
X-Processed-Time: 0.000903844833374
{
"args": {},
"data": "{\"param1\": \"a b c\", \"param2\": \"d\", \"jparam\": [\"test string\"]}",
"files": {},
"form": {},
"headers": {
"Accept": "application/json, */*",
"Accept-Encoding": "gzip, deflate",
"Connection": "close",
"Content-Length": "61",
"Content-Type": "application/json",
"Host": "httpbin.org",
"User-Agent": "HTTPie/0.9.9"
},
"json": {
"jparam": [
"test string"
],
"param1": "a b c",
"param2": "d"
},
"origin": "…",
"url": "http://httpbin.org/post"
} |
Hi, I'm a newbie to open source projects. I would like work on this issue. Could you please provide me with more info? |
@poskadesign What OS and shell is that? It looks like your shell consumed the double quotes to avoid word-splitting on the space, but then left the single quotes in the argument. |
It is something like that.. http POST https://httpbin.org/post wicked=witch casts:='["spells", "curses"]' --json |
@sriyanfernando still doesn't work (httpie 0.99, Windows 10x64, Python 3.61, standard Windows Command Prompt):
|
@poskadesign Try this:
I'm not very familiar with Windows command line, but found https://stackoverflow.com/questions/17205292/quotes-around-quotes-in-windows-command-line which is similar. |
Hey,
First of all, httpie is a magnificent piece of software. I can't remember how many colleagues I recommended using it.
There's a problem I've encountered. According to the spec providing JSON params is done via the
:=
operator. But launching httpie 0.9.9 with these params:Results in a message about invalid JSON. But
["test string"]
is valid JSON afaik.Maybe anyone could shed some line on what seems to be wrong?
The text was updated successfully, but these errors were encountered: