|
|
json.h - json2tsv - JSON to TSV converter |
|
|
 |
git clone git://git.codemadness.org/json2tsv (git://git.codemadness.org) |
|
|
 |
Log |
|
|
 |
Files |
|
|
 |
Refs |
|
|
 |
README |
|
|
 |
LICENSE |
|
|
|
--- |
|
|
|
json.h (541B) |
|
|
|
--- |
|
|
|
1 #ifndef JSON_H |
|
|
|
2 #define JSON_H |
|
|
|
3 |
|
|
|
4 #include <stddef.h> |
|
|
|
5 |
|
|
|
6 enum JSONType { |
|
|
|
7 JSON_TYPE_ARRAY = 'a', |
|
|
|
8 JSON_TYPE_OBJECT = 'o', |
|
|
|
9 JSON_TYPE_STRING = 's', |
|
|
|
10 JSON_TYPE_BOOL = 'b', |
|
|
|
11 JSON_TYPE_NULL = '?', |
|
|
|
12 JSON_TYPE_NUMBER = 'n' |
|
|
|
13 }; |
|
|
|
14 |
|
|
|
15 enum JSONError { |
|
|
|
16 JSON_ERROR_MEM = -2, |
|
|
|
17 JSON_ERROR_INVALID = -1 |
|
|
|
18 }; |
|
|
|
19 |
|
|
|
20 #define JSON_MAX_NODE_DEPTH 64 |
|
|
|
21 |
|
|
|
22 struct json_node { |
|
|
|
23 enum JSONType type; |
|
|
|
24 char *name; |
|
|
|
25 size_t namesiz; |
|
|
|
26 size_t index; /* count/index for array or object type */ |
|
|
|
27 }; |
|
|
|
28 |
|
|
|
29 int parsejson(void (*cb)(struct json_node *, size_t, const char *, size_t)); |
|
|
|
30 #endif |
|