[GH-ISSUE #4427] [feature]: Why can't the returned json format beautify? #1624

Closed
opened 2026-03-16 21:09:38 +03:00 by kerem · 10 comments
Owner

Originally created by @wyouwd1 on GitHub (Oct 11, 2024).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4427

Is there an existing issue for this?

  • I have searched the existing issues

Summary

The returned json format data cannot be beautified. I need to paste it into a text tool every time, which is a waste of time.
My version is: v2024.9.1

Why should this be worked on?

Tools should save efficiency.I remember it was working before, why doesn't it work after the update?

Originally created by @wyouwd1 on GitHub (Oct 11, 2024). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4427 ### Is there an existing issue for this? - [X] I have searched the existing issues ### Summary The returned json format data cannot be beautified. I need to paste it into a text tool every time, which is a waste of time. My version is: v2024.9.1 ### Why should this be worked on? Tools should save efficiency.I remember it was working before, why doesn't it work after the update?
kerem 2026-03-16 21:09:38 +03:00
  • closed this issue
  • added the
    feature
    label
Author
Owner

@liyasthomas commented on GitHub (Oct 11, 2024):

Can you provide instructions to reproduce this behaviour?

<!-- gh-comment-id:2406506465 --> @liyasthomas commented on GitHub (Oct 11, 2024): Can you provide instructions to reproduce this behaviour?
Author
Owner

@wyouwd1 commented on GitHub (Oct 11, 2024):

I found that there are two situations when I request an interface, one that can be beautified and one that cannot be beautified. The following is an example that I provide that cannot be beautified.
//curl
curl --request POST
--url 'https://*****/aaa/asr/aaa?token=aaa'
--header 'content-type: application/json'
--header 'timestamp: 324342342342424'
--data '{
"url": "aaa.wav",
"smoothTextEnabled": true,
"encryptFileEnabled": false,
"unDeleteFlag": true,
}'

//return data
{"code":0,"message":"success","data":{"taskSeq":"ca138bae1c81084d0346b962ee5a4b2b_eN6"}}

<!-- gh-comment-id:2406638413 --> @wyouwd1 commented on GitHub (Oct 11, 2024): I found that there are two situations when I request an interface, one that can be beautified and one that cannot be beautified. The following is an example that I provide that cannot be beautified. //curl curl --request POST \ --url 'https://*****/aaa/asr/aaa?token=aaa' \ --header 'content-type: application/json' \ --header 'timestamp: 324342342342424' \ --data '{ "url": "aaa.wav", "smoothTextEnabled": true, "encryptFileEnabled": false, "unDeleteFlag": true, }' //return data {"code":0,"message":"success","data":{"taskSeq":"ca138bae1c81084d0346b962ee5a4b2b_eN6"}}
Author
Owner

@liyasthomas commented on GitHub (Oct 11, 2024):

Is this response appearing inside the "JSON" or "RAW" tab in Response panel?

<!-- gh-comment-id:2406659514 --> @liyasthomas commented on GitHub (Oct 11, 2024): Is this response appearing inside the "JSON" or "RAW" tab in Response panel?
Author
Owner

@wyouwd1 commented on GitHub (Oct 11, 2024):

I think I know the reason. The content-type returned by this interface is text-plain; charset=UTF-8, which cannot be beautified automatically. In this case, shouldn't there be a manual beautification button? Isn't there such a button in the Body?

<!-- gh-comment-id:2406684167 --> @wyouwd1 commented on GitHub (Oct 11, 2024): I think I know the reason. The content-type returned by this interface is text-plain; charset=UTF-8, which cannot be beautified automatically. In this case, shouldn't there be a manual beautification button? Isn't there such a button in the Body?
Author
Owner

@wyouwd1 commented on GitHub (Oct 11, 2024):

Maybe you can consider beautifying automatically first, and if beautification fails, give a prompt on the status bar, together with the Status

<!-- gh-comment-id:2406687079 --> @wyouwd1 commented on GitHub (Oct 11, 2024): Maybe you can consider beautifying automatically first, and if beautification fails, give a prompt on the status bar, together with the Status
Author
Owner

@liyasthomas commented on GitHub (Oct 11, 2024):

Interesting observation. I wonder why JSON response has content-type: text-plain instead of application/json?

<!-- gh-comment-id:2406752468 --> @liyasthomas commented on GitHub (Oct 11, 2024): Interesting observation. I wonder why JSON response has content-type: text-plain instead of application/json?
Author
Owner

@wyouwd1 commented on GitHub (Oct 11, 2024):

I think the most important thing at the moment is to add the beautification button to the returned Raw.I can provide an example of the data returned by the interface.

[{"key":"server","value":"nginx"},{"key":"date","value":"Fri, 11 Oct 2024 02:47:45 GMT"},{"key":"content-type","value":"text/plain;charset=UTF-8"},{"key":"content-length","value":"88"},{"key":"connection","value":"keep-alive"},{"key":"x-backend-host","value":"0736:8090"},{"key":"x-gateway-host","value":"5130dfd8883e79b28bafe070a9a72a05a7209946266b6e5017dc365cbd74292d2f11d1121b62bab852e4d36722fa836f9eb1a6273c6c24c5c86aa47bd39bc8a9"}]

<!-- gh-comment-id:2406860953 --> @wyouwd1 commented on GitHub (Oct 11, 2024): I think the most important thing at the moment is to add the beautification button to the returned Raw.I can provide an example of the data returned by the interface. [{"key":"server","value":"nginx"},{"key":"date","value":"Fri, 11 Oct 2024 02:47:45 GMT"},{"key":"content-type","value":"text/plain;charset=UTF-8"},{"key":"content-length","value":"88"},{"key":"connection","value":"keep-alive"},{"key":"x-backend-host","value":"0736:8090"},{"key":"x-gateway-host","value":"5130dfd8883e79b28bafe070a9a72a05a7209946266b6e5017dc365cbd74292d2f11d1121b62bab852e4d36722fa836f9eb1a6273c6c24c5c86aa47bd39bc8a9"}]
Author
Owner

@liyasthomas commented on GitHub (Oct 11, 2024):

I'm afraid we can't prettify RAW data. RAW tab will render the exact raw data received from the server response, which could be a plain text, a rich media (image, video etc…), xml or any other formats.

I think the best possible solution is to enforce application/json content-type for responses, which will be automatically picked up by Hoppscotch to render the JSON tab with not only the prettified response but also enjoy other features like Filter using JSONPath Finder syntax, data schema generation etc.

I'd be happy to assist you with any other questions.

<!-- gh-comment-id:2407046354 --> @liyasthomas commented on GitHub (Oct 11, 2024): I'm afraid we can't prettify RAW data. RAW tab will render the exact raw data received from the server response, which could be a plain text, a rich media (image, video etc…), xml or any other formats. I think the best possible solution is to enforce application/json content-type for responses, which will be automatically picked up by Hoppscotch to render the JSON tab with not only the prettified response but also enjoy other features like Filter using JSONPath Finder syntax, data schema generation etc. I'd be happy to assist you with any other questions.
Author
Owner

@wyouwd1 commented on GitHub (Oct 12, 2024):

If automatic beautification does not meet the needs, can we add a manual beautification button to the results to give users a choice? I see there is one in the Body. It should be easy to copy the function.

<!-- gh-comment-id:2408292804 --> @wyouwd1 commented on GitHub (Oct 12, 2024): If automatic beautification does not meet the needs, can we add a manual beautification button to the results to give users a choice? I see there is one in the Body. It should be easy to copy the function.
Author
Owner

@kooper100 commented on GitHub (Dec 18, 2024):

the best possible solution is to enforce application/json content-type for responses, which will be automatically picked up by Hoppscotch to render the JSON tab with not only the prettified response but also enjoy other features like Filter using JSONPath Finder syntax, data schema generation etc.

The best possible solution is to fix everyone else's APIs...? Like that's not realistic at all. This is very annoying because I also have to copy and paste responses into a text editor to format properly. Please add a manual format button.

<!-- gh-comment-id:2551828404 --> @kooper100 commented on GitHub (Dec 18, 2024): > the best possible solution is to enforce application/json content-type for responses, which will be automatically picked up by Hoppscotch to render the JSON tab with not only the prettified response but also enjoy other features like Filter using JSONPath Finder syntax, data schema generation etc. > The best possible solution is to fix everyone else's APIs...? Like that's not realistic at all. This is very annoying because I also have to copy and paste responses into a text editor to format properly. Please add a manual format button.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#1624
No description provided.