Guidance for parsing & manipulating data from an API

Hi, I'm accessing data from an API and am triggering the I/O on a RevPi based on the data. I'm wondering on the best approach to parse the data and act on it. My programming now is becoming somewhat unwieldy.

I have the data coming back in an XML format. The structure is something like this:

object
payload: object
DispatchEventResult: object
$: object
DispatchEventList: array[1]
0: object
DispatchEvent: array[35]
[0 … 9]
0: object
DemandEventSourceType: array[1]
EndDate: array[1]
EventId: array[1]
FacilityName: array[1]
IsInternalTestEvent: array[1]
IsTestEvent: array[1]
IsoId: array[1]
IsoName: array[1]
MeterId: array[1]
MeterName: array[1]
ProductTypeId: array[1]
ProductTypeName: array[1]
ProgramName: array[1]
ResourceId: array[1]
StartDate: array[1]
ZoneId: array[1]
ZoneName: array[1]
1: object
2: object
3: object
4: object
5: object
6: object
7: object
8: object
9: object
[10 … 19]
[20 … 29]
[30 … 34]

What I would like to do is be able to look through each array and store the specified data, since the number of arrays can change. Right now I have the switch node storing objects and a function node but it's static and if the number of arrays change it will not work. How can I parse through this entire object and store the data associated with object:EventId?

Did you go through the documentation "working with messages" ?

Also it would be worthwhile posting up your current flow, with some real data in the debug window and an idea of how much of the data you want to access - what do you want to happen when the array length changes ? How do you identify and access the specific information you are interested in ?

Craig

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.