JSON-Viewer icon indicating copy to clipboard operation
JSON-Viewer copied to clipboard

Escaped quotes aren't recognized properly after urls

Open MikFI opened this issue 1 year ago • 1 comments
trafficstars

JSON parsed properly until there are links in the body followed by escaped quotes, which recognised as part of the url and percieved as an error even if it is properly formatted. It's a N++ issue (which reported multiple times and was fixed even... but fix wasn't accepted), but this prevents JSON from being "pretty-printed" if such option is called from "bad" block (which will be marked from such escaped quote to the end of the file)

Here is a part of OpenSSL licensing text as example: {"AGREEMENT": "<...>3. All advertising materials mentioning features or use of this software must display the following acknowledgment: "This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)"\n4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [email protected].<...>"}

Is it possible to parse URL separately (to prettify a file)?

MikFI avatar Jan 29 '24 16:01 MikFI

This isn't valid JSON, and the URL has nothing to do with it. There are a bunch of quotes that aren't properly escaped. Recall that literal " characters inside a string must have \ before them, like so: \". No reasonable JSON parser is going to be able to handle this.

Once all the quotes are escaped, your text looks like this:

{"AGREEMENT": "<...>3. All advertising materials mentioning features or use of this software must display the following acknowledgment: \"This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [email protected].<...>"}

The highlighting issue you mention, where the lexer incorrectly marks the part of a string following a URL as an error, has nothing to do with this plugin. The syntax coloring is done by a Lexilla lexer.

molsonkiko avatar Feb 17 '24 05:02 molsonkiko

Closing as not a valid bug.

SinghRajenM avatar Mar 17 '24 11:03 SinghRajenM