GET curl调用不返回JSON对象 [英] GET curl call not returning JSON object

查看:416
本文介绍了GET curl调用不返回JSON对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

curl -D- -X GET -H "Authorization: Basic --------------------=" -H     
"Content-Type: application/json" https://jira.-----------.net/rest/api/latest/search?jql=assignee=wwilson

这将返回实际的正确输出,但是当我试图管道一个命令来格式化它时,它告诉我没有JSON对象解码。

This returns actual correct output, but when I try to pipe a command to format it it tells me that no JSON object could be decoded.

{"expand":"names,schema","startAt":0,"maxResults":50,"total":1,"issues":
[{"expand":"editmeta,renderedFields,transitions,changelog,operations","id":"11497"    
,"self":"https://jira.some-company.net/rest/api/latest/issue/11497","key":"QA-
121","fields":{"summary":"Test_Run","progress":
.... Not going to give you the crapton of lines in the middle ....
{"progress":0,"total":0},"lastViewed":"2015-06-16T09:52:41.616-
0400","components":
[],"timeoriginalestimate":null,"aggregatetimespent":null}}]}

这是输出当前的样子(部分示例,JSON是正确的,但有敏感信息和 - >),但它有另外40行或者。漂亮的打印将是目标。我试过用管道...。

This is what the output currently looks like (partial example, JSON is correct, but has sensitive information and -> ), but it has another 40 lines or so. Pretty print would be the goal. I tried it by piping in...

| python -m json.tool

但是它也扔了即使它是一个有效的json ...

But again it threw even though it is a valid json...

No JSON object could be decoded

$ b $

推荐答案

-D - 包括标头在stdout。

-D- is including the headers in stdout. You should leave that off

-D 选项将标题转储到给定文件。

特殊文件名 - 是stdout

The -D option dumps the headers to the given file.
The special filename - is stdout

这篇关于GET curl调用不返回JSON对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆