Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Trying to extract data from a JSON

I’m using tabula-py to extract some data in JSON format and it is returning:
[{'extraction_method': 'stream', 'top': 580.635, 'left': 699.435, 'width': 49.5, 'height': 15.8399658203125, 'right': 748.935, 'bottom': 596.475, 'data': [[{'top': 586.55, 'left': 701.77, 'width': 33.569969177246094, 'height': 4.809999942779541, 'text': '1,227.57'}]]}]

I’m trying to get the data.text attribute which I’m struggling to get to. I’ve tried variations of:
consignment_balance[0]['data']

Looking for a hand as I’m not familiar with Python syntax.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Read the value from the JSON bit tricky here.

consignment_balance[0]['data'][0][0]['text']
# '1,227.57'

It has a nested list and dictionary so you need to access it accordingly.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading