JSON parsing

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
superg2
 
Posts: 41
Joined: Wed Aug 31, 2022 12:27 pm

JSON parsing

Post by superg2 »

I'm having issues with my circuit python project reading JSON response from my web service. The output looks correct in Postman but I receive the following error, TypeError: object with buffer protocol required. However if I double serialize my JSON, serialize my object and then serialize that result my Python script works.

Sorry if a noob question but I'm not getting it.

response = http.post(WS_URL, json=WS_JSON)
responseJSON = json.loads(response.json())

User avatar
dastels
 
Posts: 15662
Joined: Tue Oct 20, 2015 3:22 pm

Re: JSON parsing

Post by dastels »

Can you provide more information? The JSON that you get from the server and the complete REPL error information.

Dave

User avatar
superg2
 
Posts: 41
Joined: Wed Aug 31, 2022 12:27 pm

Re: JSON parsing

Post by superg2 »

Just resolved the issue, I didn't know that JSON was case sensitive and something changed in my web service started to return JSON in Camel Case and not Pascal case. Not sure what I changed for that to happen but off to look into the service

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”