[SR-Users] Jansson question

Daniel-Constantin Mierla miconda at gmail.com
Wed Apr 6 09:17:39 CEST 2022


Hello,

I haven't implemented the jansson module, but the docs suggests it
supports only path with names:

  *
https://www.kamailio.org/docs/modules/stable/modules/jansson.html#jansson.f.jansson_get

I think you can get it with transformations {s.after} and {s.before}. Or
use inline execution of a Kemi script that can help with own json parser.

Cheers,
Daniel

On 05.04.22 21:12, Barry Flanagan wrote:
> Hi
>
> I am trying to use the jannson_get function to pull field "secret"
> from the below json:
>
> {"3":{"options":{"secret":"mybigsecret"}}}
>
>
> This works is I use jansson_get("3.options.secret".....
>
> However, I need to know the value of "3" in order to use it. I have
> tried all the variations on path I can find, but none apart from using
> the actual root value work for me.
>
> How can I either:
>
> 1. Construct a PATH which will pick this up, or
>
> 2. Obtain this root value ("3" in my example)
>
> I have tried testing using https://jsonpath.com/ and a path of
> "$..secret" and "$..options.secret" works there, but not in jansson
> kamailio module.
>
> Any assistance much appreciated.
>
> Thanks
>
> -- 
> -Barry
>
>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-users at lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the sender!
> Edit mailing list options or unsubscribe:
>   * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - Online
  * https://www.asipto.com/sw/kamailio-advanced-training-online/




More information about the sr-users mailing list