Bad formatting of API json responses

Hi.
Is it possible to format JSON response from the server after calling API methods? It is inconvenient to read badly formatted output.
Thanks.

Hello,

Thanks for getting in touch. You could try some browser extensions that will help format the response. Search the Firefox add-ons site, or the Chrome extension web store.

Otherwise many desktop or web based IDEs will be able to format the JSON to correct the indentation, if you’ve copied the JSON into an editor.

Regards,
Nick

Hi, Nick.

Thank you for your reply.
Yes, I know how to format JSON in editors. The question was about your intention to produce formatted JSON output.
For example I attach JSON response from OpenStack API, it is very pleasant to read it.
I understand that for machine-to-machine communication formatting doesn’t matter, but when you are debugging that communication it’s inconvenient to read JSON without formatting.

Regards,
Alexander

Insomnia_v4.2.14_2017-04-11_08.47.15.png

Hello Alexander,

I’m sorry for my misunderstanding. We have future plans to make use of Swagger as part of an API re-write/cleanup: https://octopus.com/blog/roadmap-2017#swaggerize-our-api but no work has started on that yet.

If you have time have a look at http://swagger.io/swagger-ui/ - from the looks of it does format the output well, if we do adopt swagger will that cover your desire for formatted output?

Regards,
Nick

Hmm, really I don’t know.

Swagger is great for discovering API and creating test requests. But for more serious scenarios I, like many others, use some REST client (in my case it’s Insomnia, but it could be Postman, or any other client) which allows me to organize and save queries, use variables in queries, tune up authorization for workspaces, so you don’t need manually add authorization headers to each request.
And if using of Swagger will allow always to produce formatted output (even for cases when you request API outside of Swagger UI) – it would be great!

Regards,
Alexander