httpie / cli

🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
https://httpie.io
BSD 3-Clause "New" or "Revised" License
32.67k stars 3.68k forks source link

JSON properties are shuffled #1577

Closed imclint21 closed 1 month ago

imclint21 commented 1 month ago

Hi,

I just execute this:

http http://localhost:9021/api/development

And i get this output:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Sun, 19 May 2024 10:58:34 GMT
Server: Kestrel
Transfer-Encoding: chunked

[
    {
        "allowedIps": null,
        "configurationFile": "/tmp/proxies/ups1.conf",
        "createdAt": "2024-05-18T18:13:44.204+00:00",
        "id": "60ac07ef-5a80-4352-8b03-2ab8f68ef68f",
        "password": "string",
        "port": 1001,
        "updatedAt": "2024-05-18T18:13:44.204+00:00",
        "upstream": "ups1",
        "username": "string"
    }
]

I don't understand why properties are shuffled, should be like this:

[
  {
    "id": "60ac07ef-5a80-4352-8b03-2ab8f68ef68f",
    "createdAt": "2024-05-18T18:13:44.204+00:00",
    "updatedAt": "2024-05-18T18:13:44.204+00:00",
    "upstream": "ups1",
    "port": 1001,
    "username": "string",
    "password": "string",
    "allowedIps": null,
    "configurationFile": "/tmp/proxies/ups1.conf"
  }
]

Regards

onlined commented 1 month ago

They are not shuffled, they are alphabetically sorted.

imclint21 commented 1 month ago

Ah I see, why touch it tho?

onlined commented 1 month ago

I don't know, just wrote thinking it might be helpful.

onlined commented 1 month ago

You can try --unsorted option, for more detail: https://httpie.io/docs/cli/format-options

Ousret commented 1 month ago

As clarified in the thread, this is not an issue but clearly what was intended by the author. It was a UX decision and it is understandable how you got confused. Two sides emerge for this:

But as you found the workaround for this, I am inclined to close it.