Kong / insomnia

The open-source, cross-platform API client for GraphQL, REST, WebSockets, SSE and gRPC. With Cloud, Local and Git storage.
https://insomnia.rest
Apache License 2.0
34.3k stars 1.93k forks source link

Beautify JSON alters the content of the JSON #5973

Open francoisWeber opened 1 year ago

francoisWeber commented 1 year ago

Expected Behavior

Simply reshape a JSON by breaking lines between keys: values, indenting ...

Actual Behavior

Actually reshapes JSON as expected AND inserts or removes spaces inside my values

Reproduction Steps

Is there an existing issue for this?

Additional Information

This was not a problem a few version ago - I used this feature extensively

Insomnia Version

2023.2.1

What operating system are you using?

macOS

Operating System Version

Ventura 13.3.1

Installation method

official .dmg

Last Known Working Insomnia version

I dunno how to get my update's history :/

mjasnowski commented 1 year ago

I'm on 2023.1.0 (MacOSX) and see similar behavior, but a couple observations:

  1. Insomnia is flagging that snippet as Invalid JSON. I saw a similar validation complaints if you go to someplace like jsonlint.com and validate it.

Screenshot 2023-05-19 at 12 56 14 PM

  1. Changing the ' to " kept the key value intact, clicking "Beautify JSON" resulted in:
    {
    "model.queryString": "hook honkai rail",
    "searchChain": "web_current_for_vse_random",
    "ranking.features": {
        "query(safe_search)": "strict"
    },
    "hits": 10,
    "presentation.summary": "default",
    "model.locale": "fr-fr",
    "model.sources": "mercury",
    "query(non_relevant_url_0)": "https://www.ign.com/wikis/honkai-star-rail/Hook",
    "query(non_relevant_url_1)": "https://game8.co/games/Honkai-Star-Rail/archives/410920"
    }
SalahAdDin commented 1 year ago

This is also happening in Linux: image

At beautifying: image

francoisWeber commented 1 year ago

OK that snippets comes from a Python script and I just printed it ... This explains the ' instead of ". So maybe Insomnia should raise an error rather than trying to lint it ?