1

I am trying to load a json-like string using the json library:

data = json.loads(raw_json.replace(" ","").replace("\n",""))

However I get the following error:

JSONDecodeError: Expecting ',' delimiter

I looked at this question but it doesn't seem to help... also I have no idea howto convert my string to a raw string using its variable name... The only problem that I can see in my raw_json variable is that it has a lot of spaces and newlines. My raw_json variable looks like this:

{

"search": {
"levier": "Recherchedepuislaliste",
"nbresults": "137 314",
"nbpage": "1",
"typedetransaction": ["vente", "viager"],
"nbpieces": [""],
"typedebien": ["Appartement", "Maison/Villa"],
"pays": "FR",
"nbchambres": [""],
"budget": {"min": "", "max": ""},
"surface": {"min": "", "max": ""},
"surface_terrain": {"min": "", "max": ""},
"type": [{"name": "Nouvellerecherche", "value": true},
        {"name": "Dernièrerecherche", "value": false},
        {"name": "Rechercheenregistrée", "value": false}],
"etage": {"min": "", "max": ""},
"tri": {"criteria": "Sélection",
        "direction": ""},
"chauffage": [{"name": "individuel", "value": false},
              {"name": "central", "value": false},
              {"name": "electrique", "value": false},
              {"name": "gaz", "value": false}]
}
divibisan
  • 11,659
  • 11
  • 40
  • 58
Vincent
  • 151
  • 3
  • 12

1 Answers1

1

There is everything correct except that the closing bracket is missing, just add an } to the end of your JSON-object.

lustigo
  • 26
  • 2