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