Please login or register to access secure site features.

Note: By continuing to use DevConnect Program Services you agree to our latest Registered Member Terms.

Sign in using DevConnect ID

Forgot password?

Trouble logging in?

Submit a ticket for Registration Support.

I have an SSO ID

?
sign in

Don't have a DevConnect or SSO ID ?

Create a DevConnect account or join the program.

register now
^
Forum Index » Avaya Orchestration Designer » OD 7.2.3 / OD 8.0 Using JSON Parser guidens   XML
 
Author Message
JanPetersen



Joined: 18/03/2015 03:45:57
Messages: 29
Offline

Hi DevConnect

I have not been able to find any thing in developer guide.

I need guidance how to use JSON Parser in OD

I have this example:

{
"phoneNumbers": [
{
"type" : "iPhone",
"number": "0123-4567-8888"
},
{
"type" : "home",
"number": "0123-4567-8910"
}
]
}

Is it possible to get the number key where "type" is "home"

Path Constant in JSON Parser

Something like phoneNumbers/"type"="home"/number

Result = 0123-4567-8910

Please advice

Regards
Jan


WilsonYu



Joined: 06/11/2013 14:29:24
Messages: 3720
Offline

Attached the the sample app that works on your JSON string.
 Filename SampleJSONParserApp.zip [Disk] Download
 Description No description given
 Filesize 526 Kbytes
 Downloaded:  54 time(s)

JanPetersen



Joined: 18/03/2015 03:45:57
Messages: 29
Offline

Thanks Wilson

That was helpful

*1 Could you provide a document that explains the use of the "JSON Parser" ?

*2 I have this output with Square brackets [ ]
I need to get the "False" value of the "Value" in array with "name" = "Key1"

How do I do that?

[
{
"id": 8,
"name": "Menu01",
"parameterGroupRefId": 15,
"childrenGroups": [],
"parameters": [
{
"parameterGroupRefId": 15,
"id": 18,
"name": "Key0",
"componentType": "text",
"dataType": "openInput",
"defaultValue": "0",
"value": "True",
"parameterOptionDefault": [],
"parameterOptionSelected": [],
"valueToUse": "True"
},
{
"parameterGroupRefId": 15,
"id": 19,
"name": "Key1",
"componentType": "text",
"dataType": "openInput",
"defaultValue": "0",
"value": "False",
"parameterOptionDefault": [],
"parameterOptionSelected": [],
"valueToUse": "False"
}
],
"groupEmpty": false
}
]


Regards
Jan
WilsonYu



Joined: 06/11/2013 14:29:24
Messages: 3720
Offline

We don't have a document. The sample app I provided you should work the best to demo how you first use the parser function to get the array and then loop through each JSON object in the array and you use the parser function to get the item from each JSON object.
You would just do almost the same thing for this JSON string. However, since this string starts with "[", you would have do little tweak before putting it through the parser function to get the first array.
I attached the update app to work with this new string you have. Take a look at the Parse node to see the difference.


 Filename SampleJSONParserApp2.zip [Disk] Download
 Description No description given
 Filesize 535 Kbytes
 Downloaded:  48 time(s)

 
 
Go to: