Browse code

modules: readme files regenerated - jansson ... [skip ci]

Kamailio Dev authored on 23/10/2020 08:46:37
Showing 1 changed files
... ...
@@ -33,7 +33,9 @@ Carsten Bock
33 33
               3.2. jansson_set(type, key/path, value, result)
34 34
               3.3. jansson_append(type, key/path, value, result)
35 35
               3.4. jansson_array_size(key/path, src, dst)
36
-              3.5. jansson_get_field(src, field_name, dst)
36
+              3.5. jansson_xdecode(json, xavp)
37
+              3.6. jansson_xencode(xavp, pv)
38
+              3.7. jansson_get_field(src, field_name, dst)
37 39
 
38 40
    List of Examples
39 41
 
... ...
@@ -42,7 +44,9 @@ Carsten Bock
42 44
    1.3. jansson_append usage
43 45
    1.4. jansson_array_size usage
44 46
    1.5. array concatenation
45
-   1.6. jansson_get_field usage
47
+   1.6. jansson_xdecode usage
48
+   1.7. jansson_xencode usage
49
+   1.8. jansson_get_field usage
46 50
 
47 51
 Chapter 1. Admin Guide
48 52
 
... ...
@@ -60,7 +64,9 @@ Chapter 1. Admin Guide
60 64
         3.2. jansson_set(type, key/path, value, result)
61 65
         3.3. jansson_append(type, key/path, value, result)
62 66
         3.4. jansson_array_size(key/path, src, dst)
63
-        3.5. jansson_get_field(src, field_name, dst)
67
+        3.5. jansson_xdecode(json, xavp)
68
+        3.6. jansson_xencode(xavp, pv)
69
+        3.7. jansson_get_field(src, field_name, dst)
64 70
 
65 71
 1. Overview
66 72
 
... ...
@@ -89,7 +95,9 @@ Chapter 1. Admin Guide
89 95
    3.2. jansson_set(type, key/path, value, result)
90 96
    3.3. jansson_append(type, key/path, value, result)
91 97
    3.4. jansson_array_size(key/path, src, dst)
92
-   3.5. jansson_get_field(src, field_name, dst)
98
+   3.5. jansson_xdecode(json, xavp)
99
+   3.6. jansson_xencode(xavp, pv)
100
+   3.7. jansson_get_field(src, field_name, dst)
93 101
 
94 102
 3.1.  jansson_get(key/path, src, dst)
95 103
 
... ...
@@ -223,7 +231,31 @@ while($var(count) < $var(appendme_size)) {
223 231
 }
224 232
 ...
225 233
 
226
-3.5.  jansson_get_field(src, field_name, dst)
234
+3.5.  jansson_xdecode(json, xavp)
235
+
236
+   Parse a JSON string in 'json' and store the elements in xapv 'xavp'.
237
+   Top-level JSON must be an object or an array of objects. Nested arrays
238
+   and objects are not decoded but stored as string.
239
+
240
+   Example 1.6. jansson_xdecode usage
241
+...
242
+jansson_xdecode('{"foo":"bar"}', "js");
243
+xlog("foo is $xavp(js=>foo)");
244
+...
245
+
246
+3.6.  jansson_xencode(xavp, pv)
247
+
248
+   Encode the items in the xavp 'xavp' as JSON and store the result in a
249
+   pv. Nested xavps's are not supported.
250
+
251
+   Example 1.7. jansson_xencode usage
252
+...
253
+$xavp(a=>foo) = "bar";
254
+jansson_xencode("a", "$var(js)");
255
+# $var(js) = '{"foo":"bar"}'
256
+...
257
+
258
+3.7.  jansson_get_field(src, field_name, dst)
227 259
 
228 260
    Copy field 'field_name' from json object 'src' and store it in pvar
229 261
    'dst'.
... ...
@@ -232,7 +264,7 @@ while($var(count) < $var(appendme_size)) {
232 264
    now it is just a wrapper around jansson_get, and its functionality is
233 265
    the same.
234 266
 
235
-   Example 1.6. jansson_get_field usage
267
+   Example 1.8. jansson_get_field usage
236 268
 ...
237 269
 jansson_get_field("{'foo':'bar'}", "foo", "$var(foo)");
238 270
 xlog("foo is $var(foo)");