question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

httpie changing the json fields order in the output

See original GitHub issue

Wondering how can I force httpie to not change the json fields order?

curl -i http://localhost:8080/v1/notes/569766aed4c661fba8d85a12

{
  "id": "569766aed4c661fba8d85a12",
  "content": "hi"
}

with httpie

http get :8080/v1/notes/569766aed4c661fba8d85a12 

{
  "content": "hi",
  "id": "569766aed4c661fba8d85a12"
}

I prefer the id field to be always the first. Any thoughts?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:4
  • Comments:27 (4 by maintainers)

github_iconTop GitHub Comments

22reactions
carlfishcommented, Sep 16, 2016

I just lost way more time than I’m comfortable admitting trying to track down a problem in my server-side JSON library because I couldn’t work out why it was sending the data out in the wrong order. It didn’t even occur to me that the client could be reordering stuff.

Is it even worthwhile having the option to reorder JSON? 90% of the time it’s going to obfuscate rather than improve server output.

I’d submit a pull request, but it would just be changing a “True” to a “False” in one file. 😃 (see below)

13reactions
Baekalfencommented, Mar 15, 2018

Is there any traction on this issue? Like @carlfish, I have just spend an embarrassingly long amount of time trying to correct a bug in my server, only to find, that httpie was the issue.

It seems very unintuitive that it would reorder/sort data from the server, without the user explicitly enabling it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

httpie changing the json fields order in the output #427 - GitHub
Wondering how can I force httpie to not change the json fields order? ... I prefer the id field to be always the...
Read more >
JSON - HTTPie 3.2.1 (latest) docs
HTTPie does several things by default in order to make its terminal output easy to read. Colors and formatting. Syntax highlighting is applied...
Read more >
How can we change the order of JSON Object using Java?
1. A JSON object is an unordered collection of name/value pairs. – Robby Cornelissen · You may not be able to do with...
Read more >
httpie 0.3.0 - PyPI
Expressive and intuitive syntax. Formatted and colorized terminal output. Built-in JSON support. Forms and file uploads. HTTPS, proxies, and authentication.
Read more >
Preserving JSON object keys order, in JavaScript, Python, and ...
The keys order problem of a JSON object. In above encoding example I've shown only the output from JavaScript code, there is a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found