Python Forum
500 error cannot deserialize json object - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: 500 error cannot deserialize json object (/thread-12915.html)



500 error cannot deserialize json object - SaiBhargav - Sep-18-2018

Unable to resolve this error while calling API endpoint in flask. Passing the data as json in the POST request. Could someone hep me with the way to resolve this error.

Output:
[500 b'Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Guid[]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.\r\nPath 'id', line 1, position 6.' ]
My code
[def sync_user_direct(self):
            self.port = 4240
            path = 'qrs/usersdirconnect/syncuserdirect'
            body = {"id": "fba0485e-2f45-4a2f-951c-ef257f469ba8"}
            print(self.post(path, data=json.dumps(body)))
            return json.loads(self.post(path, data=json.dumps(body)).decode('utf-8'))]
Thanks.