1 /*************************************************************************//**
3 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 ****************************************************************************/
28 * JSON type identifier. Basic types are:
32 * o Other primitive: number, boolean (true/false) or null
43 /* Not enough tokens were provided */
44 JSMN_ERROR_NOMEM = -1,
45 /* Invalid character inside JSON string */
46 JSMN_ERROR_INVAL = -2,
47 /* The string is not a full JSON packet, more bytes expected */
52 * JSON token description.
53 * @param type type (object, array, string etc.)
54 * @param start start position in JSON data string
55 * @param end end position in JSON data string
62 #ifdef JSMN_PARENT_LINKS
68 * JSON parser. Contains an array of token blocks available. Also stores
69 * the string being parsed now and current position in that string
72 unsigned int pos; /* offset in the JSON string */
73 unsigned int toknext; /* next token to allocate */
74 int toksuper; /* superior token node, e.g parent object or array */
78 * Create JSON parser over an array of tokens
80 void jsmn_init(jsmn_parser *parser);
83 * Run JSON parser. It parses a JSON data string into and array of tokens, each describing
84 * a single JSON object.
86 int jsmn_parse(jsmn_parser *parser, const char *js, size_t len,
87 jsmntok_t *tokens, unsigned int num_tokens);
93 #endif /* __JSMN_H_ */