05-01-2022 10:24 PM - edited 05-01-2022 10:28 PM
I am automating a task via the SDWAN API and whenever I request a response from methods like get_device_config or export_device_template_list, I get below error.
result_json = json.loads(response.text)
File "C:\Users\htmc0583\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\htmc0583\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\htmc0583\AppData\Local\Programs\Python\Python39\lib\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 1 (char 0)
The json that I am getting is not valid for some reason. Anybody faced the same issue and any solution to this?
05-02-2022 05:47 AM
@hrmt92 “json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)” can occur when you try to decode an empty string as JSON. This might occur when your code is accessing a web API and getting an empty response, reading a file with nothing in it, or simply passing an empty string to json.loads().
06-20-2022 05:03 AM
Hello @hrmt92 did you get a solution to this problem??
If so can you please share the solution
06-21-2022 10:07 PM
No @rohanupadhye01 , not yet. Alot of methods are working well but some just do not give validated json I think.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide