handle list of multiple parameters in a!fromJSon

A Score Level 2
If I may continue the post: forum.appian.com/.../e-197406
I stumbled upto the similar issue where I get list multiple parameters from restful web-service and I am not able to index the label value pair. Could you please help.
For eg:
{"Employee":[{"Name":"ABC","Address":[{"addr1":"address line 1","addr2":"address Line 2","city":"London","Country":"UK"},
{"addr1":"address line 1","addr2":"address Line 2","city":"Mexico City","Country":"Mexico"}]}]}

If i use a!fromJson and index the value, I am able to index Name but not Address. Address length appear to be 1 and i cant further index using addr1, or city, etc.
Please help!

OriginalPostID-241375



  Discussion posts and replies are publicly visible

Parents
  • Hi ,
    As of my knowledge,
    I tried below code its working fine and it will gives output, but when i pass value as rule input(text) it give an Error.

    load(
    local!value:{"Employee":{{"Name":"ABC","Address":{{"addr1":"address line 1","addr2":"address1 Line 2","city":"London","Country":"UK"},
    {"addr1":"address line 1","addr2":"address2 Line 2","city":"Mexico City","Country":"Mexico"}}}}},
    local!a: a!toJson(local!value),
    local!fromJson:a!fromJson(local!a),
    local!fromJson.Employee.Address[1].addr2
    )
Reply
  • Hi ,
    As of my knowledge,
    I tried below code its working fine and it will gives output, but when i pass value as rule input(text) it give an Error.

    load(
    local!value:{"Employee":{{"Name":"ABC","Address":{{"addr1":"address line 1","addr2":"address1 Line 2","city":"London","Country":"UK"},
    {"addr1":"address line 1","addr2":"address2 Line 2","city":"Mexico City","Country":"Mexico"}}}}},
    local!a: a!toJson(local!value),
    local!fromJson:a!fromJson(local!a),
    local!fromJson.Employee.Address[1].addr2
    )
Children
No Data