API Help

Chris Angelico rosuav at gmail.com
Wed Jun 14 16:38:06 EDT 2017


On Thu, Jun 15, 2017 at 6:33 AM, Bradley Cooper
<brad at midwestaftermarket.com> wrote:
> I am working with an API and I get a return response in this format.
>
>
> [{"itemNumber":"75-5044","inventory":[{"warehouseCode":"UT-1-US","quantityAvailable":0.0000000000000},{"warehouseCode":"KY-1-US","quantityAvailable":0.0000000000000},{"warehouseCode":"TX-1-US","quantityAvailable":14.0000000000000},{"warehouseCode":"CA-1-US","quantityAvailable":4.0000000000000},{"warehouseCode":"AB-1-CA","quantityAvailable":1.0000000000000},{"warehouseCode":"WA-1-US","quantityAvailable":0.0000000000000},{"warehouseCode":"PO-1-CA","quantityAvailable":0.0000000000000}]}]
>
> What is the best way to read through the data?

That looks like JSON. Check out Python's json module:

https://docs.python.org/3/library/json.html

ChrisA



More information about the Python-list mailing list