callumlocke / json-formatter

Makes JSON easy to read.
https://chrome.google.com/webstore/detail/json-formatter/bcjindcccaagfpapjjmafapmmgkkhgoa?hl=en
BSD 3-Clause "New" or "Revised" License
3.76k stars 859 forks source link

Problem about "pre" tag that contains a string beginning with "[" or "{" #275

Open gypark opened 3 months ago

gypark commented 3 months ago

(Maybe someone has reported it already but...)

Hello,

Today I found this plugin modifies a plain html, if it contains a <pre> tag in which a string begins with [ or {.

Body Text

[ begin with a bracket, but not JSON



* When this plugin is disabled:

![image](https://github.com/callumlocke/json-formatter/assets/1311090/2e12f370-7536-4021-8c4e-083b2460f606)

* When enabled:

![image](https://github.com/callumlocke/json-formatter/assets/1311090/c16633d4-02c4-491f-a771-d0bd98885b32)

* In the developer's tool: `pre` tag is moved into the first place in `body`

![image](https://github.com/callumlocke/json-formatter/assets/1311090/9c52aa7a-86fa-481a-b8ba-6f47c9901d62)

It seems that JSON formatter tries to format the string in the `pre` tag and failed because the string isn't a valid JSON.

Thanks.