JSONPATH

6 views
Skip to first unread message

Esam Naas

unread,
Sep 27, 2019, 3:43:58 AM9/27/19
to 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

unread,
Sep 27, 2019, 8:19:26 PM9/27/19
to 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

unread,
Oct 1, 2019, 12:50:45 PM10/1/19
to orb...@googlegroups.com
Perfect worked like charm thanks

Alessandro Vernet

unread,
Oct 1, 2019, 6:47:50 PM10/1/19
to orb...@googlegroups.com
Perfect Esam, and thank you for the confirmation.

‑Alex

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

Esam Naas

unread,
Oct 10, 2019, 9:38:19 AM10/10/19
to 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

unread,
Oct 11, 2019, 7:51:47 PM10/11/19
to 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

unread,
Oct 14, 2019, 5:50:12 AM10/14/19
to orb...@googlegroups.com
Done, figured it out same day.

Alessandro Vernet

unread,
Oct 14, 2019, 6:06:22 PM10/14/19
to orb...@googlegroups.com
Perfect Esam, and thank you for the confirmation!

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply all
Reply to author
Forward
0 new messages