summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/json.c13
-rw-r--r--libs/json.h4
2 files changed, 17 insertions, 0 deletions
diff --git a/libs/json.c b/libs/json.c
new file mode 100644
index 0000000..4b0dac0
--- /dev/null
+++ b/libs/json.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <json-c/json.h>
+#include "json.h"
+
+json_object* jsonParseString(char* stringedJSON)
+{
+ struct json_object *json;
+ json = ( stringedJSON != NULL && strlen(stringedJSON) > 0 ) ? json_tokener_parse(stringedJSON) : NULL;
+ free(stringedJSON);
+ return json;
+}
diff --git a/libs/json.h b/libs/json.h
new file mode 100644
index 0000000..3896805
--- /dev/null
+++ b/libs/json.h
@@ -0,0 +1,4 @@
+#pragma once
+#include <json-c/json.h>
+
+json_object* jsonParseString(char* stringedJSON);