jsmn_parse requires extra loop over tokens array to know number of tokens have been extracted
It looks there is no quick way to know how many tokens have been pushed into "jsmntok_t *tokens" param of jsmn_parse method.
To understand how many tokens have been extracted user should make an extra iteration over tokens array. The extra iteration should be done before calling jsmn_parse method. It is necessary to init jsmntype_t member of every tokens array member by an invalid value (-1 for example). Once jsmn_parse returns JSMN_SUCCESS the invalid value of jsmntype_t member can be used to ensure end of extracted data reached.