hi i have the result for get response for url wchich looks like this
how to access each parameter and assigned to variable
{
"resultSet":{
"returncnt":1,
"totalCount:10
},
"result":[
{
"type":"
"id":"436ghffs"
]
}
hi i have the result for get response for url wchich looks like this
how to access each parameter and assigned to variable
{
"resultSet":{
"returncnt":1,
"totalCount:10
},
"result":[
{
"type":"
"id":"436ghffs"
]
}
First of all your response looks incorrect, assuming below is correct response:
response = '{"resultSet":{"returncnt":1,"totalCount":10},"result":[{"type":"", "id":"436ghffs"}]}'
You can try something like this:
import json
response = '{"resultSet":{"returncnt":1,"totalCount":10},"result":[{"type":"", "id":"436ghffs"}]}'
result = json.loads(response)
print (result['resultSet']['returncnt'])
Output - 1
You can iterate over each element using "for" and get the values as shown below.
for x in result['result']:
print(x['id'])
Hope this helps!