Python newbie, please be gentle.
If you can point out what I'm looking at, I can hopefully self help from here in:
I'm attempting a task that will return a list of object ID's from a database via JSON, but in all the JSON reading I've done I still seem unable to discern what the pieces of the puzzle are that I'm looking at, at least by name, and more by function, and that's stopping me from getting further reading help / specs.
Here's an example:
{"objectIdFieldName":"OBJECTID","objectIds":[5834,5835,5836,5837,5838,5839,5840,5841,5842,5843]}
Am I looking at:
Object: Begins and ends with the curly braces {}, so the whole thing is the object
String: objectIdFieldName and associated value OBJECTID (So OBJECTID is the name of my DB table?)
String: objectIds and an associated [array of the id's]. I'm not sure of what to call the 'objectIds'. It's not a JSON object, what is it?
Assuming that the above is right, then I'm looking for a way to load the array of objectIds into a Python list where I can hopefully iterate through them.
I am getting hung up trying to return the objectIds in to a list - for example, in the below I'm not entirely sure how to return the objectIds just to the command window. How would I return the objectIds?
>>> import json >>> import requests >>> result = requests.get('https://Really_Long_Internal_URL&f=json').json() >>> for x in result: #<-- This line and the next should return my array, eg 5834,5835,5836, but I'm not sure how ... print (x) ... objectIds objectIdFieldName >>>Thanks for any help you might be able to impart