0

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.

aszet
  • 83
  • 7
  • 1
    `consignment_balance[0]['data'][0][0]['text']`. You'll need to consider when those lists might have more than one item. – Tim Roberts Oct 10 '22 at 00:06

1 Answers1

1

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.

Rahul K P
  • 15,740
  • 4
  • 35
  • 52