diff options
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | libs/json.c | 13 | ||||
-rw-r--r-- | libs/json.h | 4 |
3 files changed, 23 insertions, 3 deletions
@@ -2,17 +2,20 @@ # See LICENSE file for copyright and license details. # Source Code -SRC = queryt.c utils.c libs/curl.c libs/string.c video.c +SRC = queryt.c utils.c video.c libs/curl.c libs/string.c libs/json.c + +# Libraries +LIBS = -lcurl -ljson-c # Compiled Code CLEAN = queryt # MakeOPTS build: clean - cc -o queryt ${SRC} -lcurl + cc -o queryt ${SRC} ${LIBS} debug: clean - cc -g -o queryt ${SRC} -lcurl + cc -g -o queryt ${SRC} ${LIBS} clean: rm -rf ${CLEAN} 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); |