B
B
bozuriciyu2019-12-12 01:12:11
JavaScript
bozuriciyu, 2019-12-12 01:12:11

Why is JSON invalid?

When trying to JSON.parse a string containing this JSON, an error occurs - https://pastebin.com/raw/xFf8JJEL (don't pay attention to the extra comma, by chance)
Validation in online validators also fails (you can copy it directly from the browser, I checked, the error is reproduced)
How to parse such lines? The original line is here, in the JSON-LD script tag - https://hiphopdx.com/news/id.53774/title.mc-eiht-s...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Shohruh Shaimardonov, 2019-12-12
@joeberetta

I don’t know how you pass the string to JSON.parse, but everything is fine with me

A
Anton Neverov, 2019-12-12
@TTATPuOT

Obviously, the problem is a long space.
Change the encoding back and forth from CP-1251 to UTF-8 and back, it will most likely help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question