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

Jonathan Hunter hunterj91 at hotmail.com
Wed Sep 14 14:09:54 CEST 2016

Hi guys,
Sorry for the noise!
This works;

From: hunterj91 at hotmail.com
To: sr-users at lists.sip-router.org
Date: Wed, 14 Sep 2016 08:41:41 +0000
Subject: [SR-Users] jansson_get path to access a JSON reponse containing an	array

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.

SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users at lists.sip-router.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160914/6d6092ce/attachment.html>

More information about the sr-users mailing list