aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/json.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/json.h')
-rw-r--r--include/json.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/json.h b/include/json.h
new file mode 100644
index 0000000..3bf8a9e
--- /dev/null
+++ b/include/json.h
@@ -0,0 +1,15 @@
+#ifndef GSR_JSON_H
+#define GSR_JSON_H
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include "../external/sj.h"
+
+bool gsr_json_string_equals(const sj_Value *value, const char *str);
+/* Fails if |value| is not a json number without a fractional part */
+bool gsr_json_number_to_int64(const sj_Value *value, int64_t *result);
+/* An escaped string can become 6 times as large as |str|. The result is truncated when it doesn't fit in |buffer| */
+void gsr_json_escape_string(char *buffer, size_t buffer_size, const char *str);
+
+#endif /* GSR_JSON_H */