aboutsummaryrefslogtreecommitdiff
path: root/json/jsonparse.h
diff options
context:
space:
mode:
authorjacopo grandi <jak.sk8@hotmail.it>2021-02-18 14:14:23 +0100
committerjacopo grandi <jak.sk8@hotmail.it>2021-02-18 14:14:23 +0100
commit5f0fce4191309e9526b7109a0d87c092ce6a4193 (patch)
tree105257f876551814aa74a0760ec116bd1bf307a5 /json/jsonparse.h
parentead78d51e662057467b79d3a65b20c4ba83cbf07 (diff)
main
Diffstat (limited to 'json/jsonparse.h')
-rw-r--r--json/jsonparse.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/json/jsonparse.h b/json/jsonparse.h
new file mode 100644
index 0000000..2186154
--- /dev/null
+++ b/json/jsonparse.h
@@ -0,0 +1,35 @@
+#ifndef JSONPARSE_H
+#define JSONPARSE_H
+
+#define JSMN_STATIC
+#include <jsmn.h>
+
+#define MAXTOKENS 2048
+
+void substr_token(char *json, char *temp, jsmntok_t *t);
+
+void json_parse_array(char *json, void *temp, jsmntok_t *t, int r, char type);
+void json_dump_array (char *str, void *arr, int len, char type);
+
+int json_parse_subtokens (char *json, jsmntok_t *t, int r, int i);
+/*
+
+typedef struct { char key[32]; int i; } pair_ci;
+typedef struct { char key[32]; float i; } pair_cf;
+
+
+int json_parse_dict_ci_init (char *json, pair_ci *dict, jsmntok_t *t, int r);
+int json_parse_dict_cf_init (char *json, pair_cf *dict, jsmntok_t *t, int r);
+int json_parse_dict_ci (char *json, pair_ci *dict);
+int json_parse_dict_cf (char *json, pair_cf *dict);
+
+#define MAXLISTLEN 64
+#define MAXOBJLEN 32
+
+typedef struct { pair_ci pairs[MAXOBJLEN]; int len; } list_ci;
+typedef struct { pair_cf pairs[MAXOBJLEN]; int len; } list_cf;
+
+int json_parse_list_ci (char *json, list_ci *list);
+int json_parse_list_cf (char *json, list_cf *list);
+*/
+#endif \ No newline at end of file