geojson2dm

Convert GeoJSON to format suitable for input to datamaps
git clone git://git.sikmir.ru/geojson2dm
Log | Files | Refs | README | LICENSE

json.h (537B)


      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 *));
     30 #endif