[SR-Users] Jansson question

Barry Flanagan barry at flanagan.ie
Tue Apr 5 21:12:02 CEST 2022


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xB1C81B216B50A825.asc
Type: application/pgp-keys
Size: 3074 bytes
Desc: OpenPGP public key
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220405/7f61329f/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220405/7f61329f/attachment.sig>


More information about the sr-users mailing list