Indeed, as I looked at the code, jansson_get() treats the first parameter as json-path and . is a delimiter there.

With the stable kamailio versions at this moment, up to 5.7.x, you can use json module which should work with field name, no json-path.

Alternatively, you can use the an embedded scripting language to parse the json, for example app_jsdt module is offering embedded javascript without any external dependency and inside it you can use JS function JSON.parse(), then walk through the structure and set the value of the desired field to a kamailio.cfg variable.

For the future major stable releases (or if you want to use git master branch now), I pushed some commits to jansson module to change the function jansson_get_field() to work only with the field name, leaving jansson_get() to work with json-path.

I am closing this issue as there are options for stable releases and the development branch got new code for it in the jansson module.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/3658/1829437174@github.com>