JSONPATH

Visto 6 veces
Saltar al primer mensaje no leído

Esam Naas

no leída,
27 sept 2019, 3:43:5827/9/19
a orb...@googlegroups.com
Hi,
I'm not able to filter in dynamic drop down menu using action receives HTTP
service results in json.
see example
JSON:
{
"firstName": "John",
"lastName" : "doe",
"age" : 26,
"address" : {
"streetAddress": "naist street",
"city" : "Nara",
"postalCode" : "630-0192"
},
"phoneNumbers": [
{
"type" : "iPhone",
"number": "0123-4567-8888"
},
{
"type" : "home",
"number": "0123-4567-8910"
}
]
}

JSONPATH
$.phoneNumbers[?(@.type=='home')]

Results
[
{
"type": "home",
"number": "0123-4567-8910"
}
]


please help
Regards,
Esam


--
Sent from: http://discuss.orbeon.com/

Alessandro Vernet

no leída,
27 sept 2019, 20:19:2627/9/19
a orb...@googlegroups.com
Hi Esam,

The expression would be `/json/phoneNumbers/_[type = 'home']`, and then I
imagine you could use `number` for both the label and value in the dropdown.

xpath.png <http://discuss.orbeon.com/file/t119778/xpath.png>

BTW, you can see that the structure of the XML that corresponds to your JSON
is by going to the HTTP Service Editor dialog, after entering the URL for
your service hitting Test, and then going to the Test Results / XML Response
Body tab. You'll let me know if this works for you.

http-service-editor.png
<http://discuss.orbeon.com/file/t119778/http-service-editor.png>

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

Esam Naas

no leída,
1 oct 2019, 12:50:451/10/19
a orb...@googlegroups.com
Perfect worked like charm thanks

Alessandro Vernet

no leída,
1 oct 2019, 18:47:501/10/19
a orb...@googlegroups.com
Perfect Esam, and thank you for the confirmation.

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

Esam Naas

no leída,
10 oct 2019, 9:38:1910/10/19
a orb...@googlegroups.com
Quick one, can I feed 3 drop down menus with one http service please?
At the moment I'm using 3 http with 3 actions to populate data

Regards,

Esam

Alessandro Vernet

no leída,
11 oct 2019, 19:51:4711/10/19
a orb...@googlegroups.com
Hi Esam,

Yes, you can! In the "Actions Editor" dialog, in the "Service Response
Actions" tab, click 3 times on the "+" icon (see screenshot below), and on
each row you can define the control to populate and the expressions to use
to extract the choices from what the service returns.

populating-multiple-dropdowns.png
<http://discuss.orbeon.com/file/t119778/populating-multiple-dropdowns.png>

You'll let me know if this works for you,

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

Esam Naas

no leída,
14 oct 2019, 5:50:1214/10/19
a orb...@googlegroups.com
Done, figured it out same day.

Alessandro Vernet

no leída,
14 oct 2019, 18:06:2214/10/19
a orb...@googlegroups.com
Perfect Esam, and thank you for the confirmation!

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos