This is another json parser! but more improved. Inspired by zserge's jsmn (https://github.com/zserge/jsmn) but with some changes. Basically this don't have any tokens which are filled in array unlike jsmn but instead will give data according to type JSON_Type
on each call. Currently there is no implementation of any validation logic to validate JSON according to spec, but soon I will be adding it.
This is very minimalistic and light weight which is easy to use. Only static memory allocation is used hence it can be used on small embedded systems too. Unlike jsmn which fills a array of jsmn_tokens
this returns a fast_json_parser
type struct on each call of json_parse()
which has following details:
typedef struct {
JSON_Type parsed_type;
uint8_t *Start;
uint8_t *End;
} fast_json_parser;
The parsed_type
will have enum of different JSON data types:
JSON_OBJ,
JSON_STRING,
JSON_ARRAY,
JSON_BOOL,
JSON_PRIMITIVE,
JSON_END,
JSON_UNDEFINED
The JSON_END
is not a typical JSON type data but it indicates the end of JSON string which can be useful. So instead of filling a array of different JSON type data, this parser parses it on the go! If you still need a pre-parsed array of parser type then you can loop through the JSON string and add each parsed fast_json_parser
to the array of that type or else you can use jsmn!
Contribution is welcome!
You can contact me on mrunalahirrao@yahoo.com
This has free license, so you can use it even commercially!