<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi guys,<div><br></div><div>Sorry for the noise!</div><div><br></div><div>This works;</div><div><br></div><div>jansson_get("destination[0].msisdn",</div><div><br></div><div>Thanks</div><div><br></div><div>Jon<br><br><div><hr id="stopSpelling">From: hunterj91@hotmail.com<br>To: sr-users@lists.sip-router.org<br>Date: Wed, 14 Sep 2016 08:41:41 +0000<br>Subject: [SR-Users] jansson_get path to access a JSON reponse containing an    array<br><br>

<style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}

--></style>
<div dir="ltr"><div><span style="font-size:12pt;">Hi guys,</span></div><div><br></div><div>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.</div><div><br></div><div>Please see the returned response below that I am getting on kamailio;</div><div><br></div><div><span style="font-size:12pt;">{"status":"success","destination"[{"msisdn":"4412345566","route":"Carrier1"}],"maxduration":"60","source":"447777777","message_id":"c41c1823aafb80f44620f4cdc6802c0d"}</span></div><div><br></div><div>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).</div><div><br></div><div>So currently when I do jansson_get_field("$http_rb", "destination", "$var(mapdestination)"); I get;</div><div><br></div><div><br></div><div>[{"msisdn":"447107110194","route":"carrier1"}]</div><div><br></div><div>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?</div><div><br></div><div>This is not a problem if its not an array, however if the result is contained within [] how do I indicate the path?</div><div><br></div><div>I have tried destination[0], destination.msisdn with no luck, and Im sure I am missing something so any advice would be great.</div><div><br></div><div>Thanks</div><div><br></div><div>Jon</div>                                          </div>
<br>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</div></div>                                     </div></body>
</html>