[sr-dev] [kamailio/kamailio] Strange behaviour with JSON module (#1452)

Abdul Basit basit.engg at gmail.com
Thu Feb 22 12:19:19 CET 2018


Hi Thomas,

I faced the same issue. looks like some bug with json module.

jansson_get_field(*"$var(result)", "status", "$var(status)");*

 worked for me. It resulted as expected
*INFO: <script>: SUCCESS*


--
regards,

abdul basit | p: +92 32 1416 4196 | o: +92 30 0841 1445

On 21 February 2018 at 20:41, Thomas Carvello <notifications at github.com>
wrote:

> Description Troubleshooting Reproduction
>
> Hello,
> i have an issue with the JSON module .
>
> i have JSON response from a HTTP request to process in my script:
>
> {"status":"SUCCESS"}
>
> i use the command HTTP_query:
>
> *http_query("http://xxxxx <http://xxxxx>", "$var(result)");*
>
> then i try to parse my result:
>
> *json_get_field("$var(result)", "status", "$var(status)");*
>
> But when i log my result:
> *xlog("L_INFO", "$var(status)");*
>
> i have a wrong output:
>
> *INFO: <script>: "SUCCESS"*
>
> double quote is embedded in the string variable which is wrong because
> this not part of my json value.
>
> Is there any way to fix this behaviour or having a new function in order
> to retrieve the right value of my json field?
>
> Thank you for your help.
>
>> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/kamailio/kamailio/issues/1452>, or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AF36ZTQBSiU8c6rfeldJdX5ER-bV8dZOks5tXDkmgaJpZM4SN2bQ>
> .
>
> _______________________________________________
> Kamailio (SER) - Development Mailing List
> sr-dev at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20180222/5d5adb5d/attachment-0001.html>


More information about the sr-dev mailing list