You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jsmn/jsmn.h

39 lines
782 B

#ifndef __JSMN_H_
#define __JSMN_H_
/**
* JSON type identifier. Basic types are:
* o Object
* o Array
* o String
* o Number
* o Primitive: boolean (true/false) or null
*/
typedef enum {
JSON_OTHER = 0,
JSON_OBJECT,
JSON_ARRAY,
JSON_STRING,
JSON_NUMBER
} jsontype_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_ */