1 /* SPDX-License-Identifier: MIT */
7 * JSON type identifier. Basic types are:
11 * o Other primitive: number, boolean (true/false) or null
21 /* Not enough tokens were provided */
22 JSMN_ERROR_NOMEM = -1,
23 /* Invalid character inside JSON string */
24 JSMN_ERROR_INVAL = -2,
25 /* The string is not a full JSON packet, more bytes expected */
27 /* Everything was fine */
32 * JSON token description.
33 * @param type type (object, array, string etc.)
34 * @param start start position in JSON data string
35 * @param end end position in JSON data string
45 * JSON parser. Contains an array of token blocks available. Also stores
46 * the string being parsed now and current position in that string
49 unsigned int pos; /* offset in the JSON string */
50 int toknext; /* next token to allocate */
51 int toksuper; /* superior token node, e.g parent object or array */
55 * Create JSON parser over an array of tokens
57 void jsmn_init(jsmn_parser *parser);
60 * Run JSON parser. It parses a JSON data string into and array of tokens,
61 * each describing a single JSON object.
63 jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js,
65 jsmntok_t *tokens, unsigned int num_tokens);
67 const char *jsmn_strerror(jsmnerr_t err);
69 #endif /* __JSMN_H_ */