Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Getting error while using json.load function

While trying to convert the following string into JSON object, I got an error. How can I fix it?

text = '{ "MonitorGroupGuid": "e8b20230-70b6-4348-36f3e3f", "Description": "Root CA", "IsAll":False}'
JsonObject = json.loads(text)

Output:

    x = json.loads(x)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 98 (char 97)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Replace False with false (without quotes)

text = '{ "MonitorGroupGuid": "e8b20230-70b6-4348-36f3e3f", "Description": "Root CA", "IsAll":false}'
JsonObject = json.loads(text)
print(JsonObject) #{'MonitorGroupGuid': 'e8b20230-70b6-4348-36f3e3f', 'Description': 'Root CA', 'IsAll': False}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading