- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2022 01:24 PM
I need to pull data from ServiceNow with Python and write it into an external database. The data is returned in this format:
{'result': [{'sys_id': '1c741bd70b2322007518478d83673af3', 'number': 'INC0000060', 'short_description': 'Unable to connect to email', 'assignment_group': {'link': 'https://dev12604.service-now.com/api/now/table/sys_user_group/287ebd7da9fe198100f92cc8d1d2154e', 'value': '287ebd7da9fe198100f92cc8d1d2154e'}}]}
How can I get that data into an array of objects that can be looped over for processing?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2022 01:45 PM
figured it out. I'm not familiar with python so this took longer than it should have...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2022 10:28 AM
This is really helpful and Thanks! Now I am very new to Python and API Development (I come from traditional ETL-DataStage background so apologies in advance)!
How do I create a CSV out of this JSON response for multiple rows?
Could you please post a code snippet for this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2023 10:47 AM
const data = {'result': [{'sys_id': '1c741bd70b2322007518478d83673af3', 'number': 'INC0000060', 'short_description': 'Unable to connect to email', 'assignment_group': {'link': 'https://dev12604.service-now.com/api/now/table/sys_user_group/287ebd7da9fe198100f92cc8d1d2154e', 'value': '287ebd7da9fe198100f92cc8d1d2154e'}}]};
const arrayOfObjects = JSON.parse(data).result;
for (const object of arrayOfObjects) {
console.log(object);
// Do something with the object
}