raygoel
3 years agoOccasional Contributor
Unable to get all elements from JSON Response using JSON Path
Hi All,
I have a JSON Response like this -
[
{
"Id" : "b0f9009b-87bd-4b68-9033-bb6027f1251e",
"Name" : "Carousel",
"Mode" : "Simulation",
"State" : "Offline",
"OnlineState" : "NotOnline",
"Active" : false,
"Available" : true,
"DockState" : "Docked",
"Present" : true,
"IsSimulated" : true,
"IsInstrument" : true,
"Priority" : 2,
"FirmwareVersion" : "Not available.",
"SoftwareVersion" : "Not available.",
"ModelDescription" : "Not available.",
"SerialNumber" : "Not available.",
"ConnectionMode" : "Unknown",
},
{
"Id" : "c2fc48ef-8190-495b-86ee-4b16fb793fa3",
"Name" : "Hotel",
"Mode" : "Normal",
"State" : "Offline",
"OnlineState" : "NotOnline",
"Active" : false,
"Available" : true,
"DockState" : "Docked",
"Present" : true,
"IsSimulated" : false,
"IsInstrument" : true,
"Priority" : 2,
"FirmwareVersion" : "Not available.",
"SoftwareVersion" : "Not available.",
"ModelDescription" : "Not available.",
"SerialNumber" : "Not available.",
"ConnectionMode" : "Unknown",
},
{
"Id" : "2e2b98cc-96ec-4e81-933a-aa7c4e762220",
"Name" : "MultidropCombi",
"Mode" : "Simulation",
"State" : "Offline",
"OnlineState" : "NotOnline",
"Active" : false,
"Available" : true,
"DockState" : "Docked",
"Present" : true,
"IsSimulated" : true,
"IsInstrument" : true,
"Priority" : 2,
"FirmwareVersion" : "Not available.",
"SoftwareVersion" : "Not available.",
"ModelDescription" : "Not available.",
"SerialNumber" : "Not available.",
"ConnectionMode" : "Unknown",
},
{
"Id" : "66703155-9db2-46cd-91f2-21d4a7b76a43",
"Name" : "Spinnaker",
"Mode" : "Simulation",
"State" : "Offline",
"OnlineState" : "NotOnline",
"Active" : false,
"Available" : true,
"DockState" : "Docked",
"Present" : true,
"IsSimulated" : true,
"IsInstrument" : true,
"Priority" : 1,
"FirmwareVersion" : "Not available.",
"SerialNumber" : "Not available.",
"ConnectionMode" : "Unknown",
},
{
"Id" : "516fbe5b-56c0-4ff2-a19d-3a9da703bc43",
"Name" : "Teleshake",
"Mode" : "Simulation",
"State" : "Offline",
"OnlineState" : "NotOnline",
"Active" : false,
"Available" : true,
"DockState" : "Docked",
"Present" : true,
"IsSimulated" : true,
"IsInstrument" : true,
"Priority" : 2,
"FirmwareVersion" : "Not available.",
"SoftwareVersion" : "Not available.",
"ModelDescription" : "Not available.",
"SerialNumber" : "Not available.",
"ConnectionMode" : "Unknown",
}
]
I am trying to get the ID of each device from this response in the Data Source step using JSON path. When I enter $[*]['Id'] I get 0 rows. However, if I enter something like $[1]['Id'] then I get the corresponding ID correctly.
I would like to retrieve the ID, one at a time and feed it to another endpoint using data source loop to verify the details by ID. Can someone please help me with this?
Here is a screenshot of my Data Source.
Thanks,
Ray