JSONPATH

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

JSONPATH

Esam Naas
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/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1569570235546-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: JSONPATH

Alessandro  Vernet
Administrator
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
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1569629964862-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: JSONPATH

Esam Naas
Perfect worked like charm thanks

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

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1569835521323-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: JSONPATH

Alessandro  Vernet
Administrator
Perfect Esam, and thank you for the confirmation.

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1569970067154-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: JSONPATH

Esam Naas
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

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

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1570714698580-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: JSONPATH

Alessandro  Vernet
Administrator
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
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1570837906864-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: JSONPATH

Esam Naas
Done, figured it out same day.

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

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1571046611072-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: JSONPATH

Alessandro  Vernet
Administrator
Perfect Esam, and thank you for the confirmation!

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1571090781620-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet