When I try to use json.loads
on this string in Python, I get the following error.
I don't understand why because I believe I am formatting the string correctly for JSON.
Code example below creates the following error: json.decoder.JSONDecodeError: Extra data: line 1 column 132 (char 131)
import pymongo
import json
mongo_import_str = '{"Top_Level": {"NextLevelDown": {"First": "1","Second":"2","Third":"3"}}, "NextLevelDown2": {"First":"1","Second":"2","Third":"3"}}}'
mongo_import = json.loads(mongo_import_str) collection.insert_one(mongo_import)