Module: kamailio
Branch: master
Commit: b424214e564cfb0a5625bbbbb88093e6be0ffc4d
URL:
https://github.com/kamailio/kamailio/commit/b424214e564cfb0a5625bbbbb88093e…
Author: Olle E. Johansson <oej(a)edvina.net>
Committer: Olle E. Johansson <oej(a)edvina.net>
Date: 2016-04-21T18:21:43+02:00
jansson Update jansson_get doc with return values that was hidden in the source code
---
Modified: modules/jansson/README
Modified: modules/jansson/doc/jansson_admin.xml
---
Diff:
https://github.com/kamailio/kamailio/commit/b424214e564cfb0a5625bbbbb88093e…
Patch:
https://github.com/kamailio/kamailio/commit/b424214e564cfb0a5625bbbbb88093e…
---
diff --git a/modules/jansson/README b/modules/jansson/README
index 87d28a8..113fb9a 100644
--- a/modules/jansson/README
+++ b/modules/jansson/README
@@ -110,6 +110,8 @@ Chapter 1. Admin Guide
array notation (e.g. [0]), or a combination of the two (e.g.
foo.bar[0][1].baz).
+ Returns FALSE if the data can not be parsed, TRUE otherwise.
+
The function can put a string, integer, null, or new json string into
destination. If the key/path can't be found in the JSON data structure,
the pvar is not changed. If it had a previous value, that value remains
@@ -117,8 +119,10 @@ Chapter 1. Admin Guide
Example 1.1. jansson_get usage
...
-jansson_get("inner.deep.list[3]", $var(myjson), "$var(n)");
-xlog("foo is $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)");
...
4.2. jansson_set(type, key/path, value, result)
diff --git a/modules/jansson/doc/jansson_admin.xml
b/modules/jansson/doc/jansson_admin.xml
index baab686..344de6c 100644
--- a/modules/jansson/doc/jansson_admin.xml
+++ b/modules/jansson/doc/jansson_admin.xml
@@ -73,6 +73,9 @@
The path string supports dot delimited notation (e.g. foo.bar.baz), array
notation (e.g. [0]), or a combination of the two (e.g. foo.bar[0][1].baz).
</para>
<para>
+ Returns FALSE if the data can not be parsed, TRUE otherwise.
+ </para>
+ <para>
The function can put a string, integer, null, or new json string into
destination.
If the key/path can't be found in the JSON data structure, the pvar is not
changed. If it had a previous
value, that value remains unchanged.
@@ -81,8 +84,10 @@
<title><function>jansson_get</function> usage</title>
<programlisting format="linespecific">
...
-jansson_get("inner.deep.list[3]", $var(myjson), "$var(n)");
-xlog("foo is $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)");
...
</programlisting>
</example>