json decode issue

M

Miki Tebeka

Greetings,

I'm trying to decode JSON output of a Java program (jackson) and having some issues.
The cause of the problem is the following snippet:
{
"description": "... lives\uMOVE™ OFFERS ",
}
Which causes ValueError: Invalid \uXXXX escape.

Any ideas on how to fix this?

Thanks,
 
M

MRAB

Greetings,

I'm trying to decode JSON output of a Java program (jackson) and having some issues.
The cause of the problem is the following snippet:
{
"description": "... lives\uMOVE™ OFFERS ",
}
Which causes ValueError: Invalid \uXXXX escape.

Any ideas on how to fix this?
Is that valid JSON? If not, you'll either need to fix the program which
generated it (or report it as a bug), or pre-process the JSON to
correct the error, if you know what it should be.
 
T

Terry Reedy

Is that valid JSON? If not, you'll either need to fix the program which
generated it (or report it as a bug), or pre-process the JSON to
correct the error, if you know what it should be.

If you delete or double the backslash in that one particular spot, the
string will parse, even if it is not correct.
 
N

Nobody

I'm trying to decode JSON output of a Java program (jackson) and having
some issues. The cause of the problem is the following snippet:
{
"description": "... lives\uMOVEâ„¢ OFFERS ",
}
Which causes ValueError: Invalid \uXXXX escape.

Any ideas on how to fix this?

It's the input data which is broken. The parser is behaving correctly by
raising an exception.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top