This thread got me almost there:smileyvery-happy:
I can parse the first level JSON correctly (thank you). The second level JSON, however, I am not getting counted as I had hoped I would. Any ideas on how to get the selected count to work?
I) JSON File
{
"totalResults": 7,
"limit": 100,
"offset": 0,
"items": [
{
"resourceId": "33100000",
"status": "active",
"parentResourceId": "33000001",
"resourceType": "BK",
"name": "North",
"language": "en",
"timeZoneDiff": -102,
"timeZone": "Eastern",
"dateFormat": "mm/dd/yy",
"timeFormat": "24-hour",
"inventories": {"links": [ {
"rel": "canonical",
"href": "http://demo-ofsc.etadirect.com/rest/ofscCore/v1/resources/33100000/inventories"
}]},
"users": {"links": [ {
"rel": "canonical",
"href": "http://demo-ofsc.etadirect.com/rest/ofscCore/v1/resources/33100000/users"
}]},
"workZones": {"links": [ {
"rel": "canonical",
"href": "http://demo-ofsc.etadirect.com/rest/ofscCore/v1/resources/33100000/workZones"
}]},
"workSkills": {"links": [ {
"rel": "canonical",
"href": "http://demo-ofsc.etadirect.com/rest/ofscCore/v1/resources/33100000/workSkills"
}]},
"links": [
{
"rel": "canonical",
"href": "http://demo-ofsc.etadirect.com/rest/ofscCore/v1/resources/33100000"
},
{
"rel": "describedby",
"href": "http://demo-ofsc.etadirect.com/rest/ofscCore/v1/metadata-catalog/resources"
}
]
},
{
"resourceId": "33200000",
"status": "active",
"parentResourceId": "33100000",
"resourceType": "PR",
"name": "BERTUZZI, Todd \t",
"email": "33103@sunrise.demo",
"phone": "555003310300",
"language": "en",
"timeZoneDiff": -102,
"timeZone": "Eastern",
"dateFormat": "mm/dd/yy",
"timeFormat": "24-hour",
"inventories": {"links": [ {
"rel": "canonical",
"href": "http://demo-ofsc.etadirect.com/rest/ofscCore/v1/resources/33200000/inventories"
}]},
"users": {"links": [ {
"rel": "canonical",
"href": "http://demo-ofsc.etadirect.com/rest/ofscCore/v1/resources/33200000/users"
}]},
"workZones": {"links": [ {
"rel": "canonical",
"href": "http://demo-ofsc.etadirect.com/rest/ofscCore/v1/resources/33200000/workZones"
}]},
"workSkills": {"links": [ {
"rel": "canonical",
"href": "http://demo-ofsc.etadirect.com/rest/ofscCore/v1/resources/33200000/workSkills"
}]},
"links": [
{
"rel": "canonical",
"href": "http://demo-ofsc.etadirect.com/rest/ofscCore/v1/resources/33200000"
},
{
"rel": "describedby",
"href": "http://demo-ofsc.etadirect.com/rest/ofscCore/v1/metadata-catalog/resources"
}
]
},
{
"resourceId": "33400000",
"status": "active",
"parentResourceId": "33100000",
"resourceType": "PR",
"name": "FIDDLER, Vernon",
"email": "771002@sunrise.demo",
"phone": "5555771002",
"language": "en",
"timeZoneDiff": -102,
"timeZone": "Easte
II) Working Groovy Script to "get" totalResults
import com.eviware.soapui.support.XmlHolder
import groovy.json.*
//define the location of the JSON file
def response = context.expand( '${get_descendants#Response}' ).toString()
//define "json" which will be the name of my variable
def json = new JsonSlurper().parseText (response)
//grab that json file result I want
log.info json.totalResults
III) Non-Working Groovy Script to "get" resourceId
package json
import com.eviware.soapui.support.XmlHolder
import groovy.json.*
//define the location of the JSON file
def response = context.expand( '${get_descendants#Response}' ).toString()
//log.info(response)
//define "json" which will be the name of my variable
def json = new JsonSlurper().parseText (response)
//grab that json file result I want
log.info json[1].items.resourceId
log.info json[1].items.name
log.info json[1].items.resourceType
log.info json[1].items.status
Anyone see what is wrong here with the count?