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