I'm having trouble with a JSON object being passed to me by one of our products API's. I'm using Python 2.7 to create a function to let our customer service team see details about jobs that are posted on our website. The JSON package returns an array of objects that each contain an array and an object. I need to read the array associated with one of the objects inside the main object, however their not nested. As in the array of applicants is not nested inside the object of Job. This means my usual "response[0][0]['applicantName']" won't work here.
The data below is updated, to represent what the API is actually giving me. My apologies before, I had edited it in order to protect the data. Still done the same, but it's the actual result.
What I'd like to do is let a user input the jobId and I'll provide them with a list of all the applicants related to that jobID. Since the jobID can sometimes be non-sequential, I can't use an index number, it must be the jobID number.
Can someone help?
Heres the JSON structure I get:
[{u'bids': [{u'applicantId': 221,
u'comment': 'I have applied to the job'},
{u'applicantId': 221,
u'comment': 'I have applied to the job'}],
u'job': {u'jobId': 1}},
{u'bids': [{u'applicantId': 221,
u'comment': 'I have applied to the job'},
{u'applicantId': 221,
u'comment': 'I have applied to the job'}],
u'job': {u'jobId': 1}}]
As I said, I'm working in python 2.7 using the "requests" library to call the API and .json() to read it.
Thanks in advance!