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

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}}]}

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

But again it threw even though it is a valid JSON:

No JSON object could be decoded
8
  • 1
    Your JSON is incomplete, is it returned that way? Commented Jun 16, 2015 at 14:06
  • No, it's just an example. My bad should have specified. Some of the JSON's are 1000's of lines long @Klaus Commented Jun 16, 2015 at 14:06
  • 1
    The problem is that your JSON is faulty because it's not complete. It would be good if you could post the full JSON output. Commented Jun 16, 2015 at 14:08
  • Did you test it with a shorter JSON that can be easily validated? Commented Jun 16, 2015 at 14:09
  • Is that your real password in the Basic auth? If so you should change it Commented Jun 16, 2015 at 14:10

1 Answer 1

4

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

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you! Worked beautifully @John What does the -D- stand for?
@Ian it's the short form for --dump-header

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.