Tag Archives: json.decoder.JSONDecodeError: Expecting ‘

[Solved] json.decoder.JSONDecodeError: Expecting ‘,‘ delimiter: line xx column xx (char xxx)

1. Core source code

# Convert string JSON to JSON object

dataJson=json.loads(jsonStr, strict=False)

2. Cause of problem:

  Error copying and pasting a string as a string literal into Python source code.

3. Solution:

In this case, \n is interpreted as a single character (newline character). You can fix it by using the original string text (R ”, use three quotation marks R ” ”… ” ‘to avoid escaping the’ ‘quotation marks in the string text)