#ifndef __JSMN_H_ #define __JSMN_H_ /** * JSON type identifier. Basic types are: * o Object * o Array * o String * o Number * o Other primitive: boolean (true/false) or null */ typedef enum { JSON_OTHER = 0, JSON_OBJECT, JSON_ARRAY, JSON_STRING, JSON_NUMBER } jsontype_t; typedef enum { JSMN_ERROR_NOMEM = -1, JSMN_ERROR_INVAL = -2, JSMN_ERROR_PART = -3, JSMN_SUCCESS = 0 } jsmnerr_t; /** * JSON token description. * @param type type (object, array, string etc.) * @param start start position in JSON data string * @param end end position in JSON data string */ typedef struct { jsontype_t type; int start; int end; } jsontok_t; /** * Run JSON parser. It parses a JSON data string into and array of tokens, each describing * a single JSON object. */ int jsmn_parse(const unsigned char *js, jsontok_t *tokens, size_t num_tokens, int *errpos); #endif /* __JSMN_H_ */