json.h - frontends - front-ends for some sites (experiment) (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- json.h (607B) --- 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(const char *, size_t, 30 void (*cb)(struct json_node *, size_t, const char *, size_t, void *), 31 void *); 32 #endif