How can i read json data
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 01:14 AM
{
"jobs": [
{
"details": {
"code": "123"
},
"userinfo": [
{
"user": "test"
},
{
"user": "abc"
}
]
}
]
}
above is the sample JSON i have. using above json how can i get user details.
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 01:24 AM
Please like below:
# Sample JSON data
json_data = '''
{
"jobs": [
{
"details": {
"code": "123"
},
"userinfo": [
{
"user": "test"
},
{
"user": "abc"
}
]
}
]
}
'''
# Load JSON data
data = json.loads(json_data)
# Extract user details
user_details = []
for job in data["jobs"]:
for userinfo in job["userinfo"]:
user_details.append(userinfo)
# Print user details
for user_info in user_details:
print(user_info)
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 01:25 AM
Hi @Lakshmi53 please find below script:
var json = {
"jobs": [
{
"details": {
"code": "123"
},
"userinfo": [
{
"user": "test"
},
{
"user": "abc"
}
]
}
]
};
json.jobs.forEach(function(job) {
job.userinfo.forEach(function(user) {
gs.info(user.user);
});
});
Regards
Harish
Harish
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 01:30 AM
how can i call this in scripted rest api

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 01:31 AM
Hi @Lakshmi53 you need to call after you receive JSON response
Regards
Harish
Harish