aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils-json.h
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-02-04 12:29:49 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2016-02-04 15:48:22 +0100
commitbb15844347ed0d53a795d24dce7035ab27df4e53 (patch)
treed94d8571ee1f413d472177a8053f751ad7f8e030 /src/utils-json.h
parenta647d560402059b9e3f11356b7e665fb0c66bd32 (diff)
Adding utils-json
This provides facilities for handling json. Change-Id: I325d5685ded745721a1801267b9c53beb974385c Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/utils-json.h')
-rw-r--r--src/utils-json.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/utils-json.h b/src/utils-json.h
new file mode 100644
index 0000000..9778347
--- /dev/null
+++ b/src/utils-json.h
@@ -0,0 +1,32 @@
+/*
+ Copyright 2015 IoT.bzh
+
+ author: José Bollo <jose.bollo@iot.bzh>
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+int j_object(struct json_object *obj, const char *key, struct json_object **value);
+int j_string(struct json_object *obj, const char *key, const char **value);
+int j_boolean(struct json_object *obj, const char *key, int *value);
+int j_integer(struct json_object *obj, const char *key, int *value);
+
+extern const char *j_get_string(struct json_object *obj, const char *key, const char *defval);
+extern int j_get_boolean(struct json_object *obj, const char *key, int defval);
+extern int j_get_integer(struct json_object *obj, const char *key, int defval);
+
+extern int j_add(struct json_object *obj, const char *key, struct json_object *val);
+extern int j_add_string(struct json_object *obj, const char *key, const char *val);
+extern int j_add_boolean(struct json_object *obj, const char *key, int val);
+extern int j_add_integer(struct json_object *obj, const char *key, int val);
+