I pull a series of http requests with JSON objects as response. Each Object has the same keys as below but the top name changes for each object.
I'd like to have a switch node to sort on the TAG attribute, all object that has TAG = 10060 should be processed and other object should be dropped. What should my syntax look like? The first value (in this case 520 is unique to each object)
object
- 520: object
-- accountinfo: array[1]
--- 0: object
---- HARDWARE_ID: "520"
---- TAG: "9193"
-- batteries: array[0]
-- bios: array[1]
--- 0: object
---- ASSETTAG: "No Asset Tag"
---- BDATE: "09/21/2015"
..
You can use the switch node and use the "has key" option to route using the key.
Can you post your json ?
Well, it's kinda large but I can take the first part of it that is interesting.
{"520":{"accountinfo":[{"HARDWARE_ID":"520","TAG":"9193"}],"batteries":,"bios":[{"ASSETTAG":"No Asset Tag","BDATE":"09/21/2015","BMANUFACTURER":"Phoenix Technologies LTD","BVERSION":"6.00","HARDWARE_ID":"520","MMANUFACTURER":"Intel Corporation","MMODEL":"440BX Desktop Reference Platform","MSN":"None","SMANUFACTURER":"VMware, Inc.","SMODEL":"VMware Virtual Platform","SSN":"VMware-42 38 55 09 5f d2 7f 13-d2 67 54 e8 3b 0a bf 58","TYPE":"Other"}],"controllers":[{"CAPTION":"Standard floppy disk controller","DESCRIPTION":"Standard floppy disk controller","HARDWARE_ID":"520","ID":"10619","MANUFACTURER":"(Standard floppy disk controllers)","NAME":"Standard floppy disk controller","TYPE":"Floppy Controller","VERSION":""},
Ok, so I found a dirty way of doing it.
Instead of http request node return to JSON I return to UTF-8 string and in the switch node I switch payload contains "TAG":"10060"
Problem solved.