Module: kamailio
Branch: master
Commit: d47d62f54c9115c765a1437ffc8c8e619e056f54
URL:
https://github.com/kamailio/kamailio/commit/d47d62f54c9115c765a1437ffc8c8e6…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-11-17T13:44:37+01:00
jansson: docs for jansson_pv_get() function
---
Modified: src/modules/jansson/doc/jansson_admin.xml
---
Diff:
https://github.com/kamailio/kamailio/commit/d47d62f54c9115c765a1437ffc8c8e6…
Patch:
https://github.com/kamailio/kamailio/commit/d47d62f54c9115c765a1437ffc8c8e6…
---
diff --git a/src/modules/jansson/doc/jansson_admin.xml
b/src/modules/jansson/doc/jansson_admin.xml
index b65fb70d8cd..969804c96b2 100644
--- a/src/modules/jansson/doc/jansson_admin.xml
+++ b/src/modules/jansson/doc/jansson_admin.xml
@@ -59,7 +59,8 @@
<function moreinfo="none">jansson_get(key/path, src,
dst)</function>
</title>
<para>
- Copy the value at the location 'path' from the json object
'src' and store it in pvar 'dst'.
+ Copy the value at the location 'path' from the json object 'src' and
store it in pvar 'dst'.
+ The 'src' can be a static string or a dynamic string with variables.
</para>
<para>
The path string supports dot delimited notation (e.g. foo.bar.baz),
@@ -82,7 +83,29 @@
<title><function>jansson_get</function> usage</title>
<programlisting format="linespecific">
...
-if(!jansson_get("inner.deep.list[3]", $var(myjson), "$var(n)")) {
+if(!jansson_get("inner.deep.list[3]", "$var(myjson)",
"$var(n)")) {
+ xlog("L_ERR", "Can't parse json data");
+}
+xlog("L_INFO", "foo is $var(n)");
+...
+jansson_get("test",
"{\"test\":\"abc\",\"idx\":20}",
"$var(n)")
+...
+ </programlisting>
+ </example>
+ </section>
+ <section id="jansson.f.jansson_pv_get">
+ <title>
+ <function moreinfo="none">jansson_pv_get(key/path, srcvar,
dst)</function>
+ </title>
+ <para>
+ Similar to jansson_get(), but the 'srcvar' parameter can be only a
+ variable name.
+ </para>
+ <example>
+ <title><function>jansson_pv_get</function> usage</title>
+ <programlisting format="linespecific">
+...
+if(!jansson_pv_get("inner.deep.list[3]", "$var(myjson)",
"$var(n)")) {
xlog("L_ERR", "Can't parse json data");
}
xlog("L_INFO", "foo is $var(n)");