[SR-Users] jansson_get path to access a JSON reponse containing an array

Jonathan Hunter hunterj91 at hotmail.com
Wed Sep 14 10:41:41 CEST 2016

Hi guys,
Sorry for the question but Its not clear to me using json_path and the jansson module how to get the contents of a response containing an array.
Please see the returned response below that I am getting on kamailio;
I can access any of the fields status,destination,maxduration,source,message_id fine, however you will notice with destination it has an array (as multiple destinations with other queries could return more than one choice).
So currently when I do jansson_get_field("$http_rb", "destination", "$var(mapdestination)"); I get;

How do I get into the contents of the array in the first place so I can return the msisdn value itself, and the route?
This is not a problem if its not an array, however if the result is contained within [] how do I indicate the path?
I have tried destination[0], destination.msisdn with no luck, and Im sure I am missing something so any advice would be great.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160914/5b123f27/attachment.html>

More information about the sr-users mailing list