Splitted in several files

This commit is contained in:
Benoit Blanchon
2014-01-11 15:05:35 +01:00
parent 583589c05c
commit e924bef409
10 changed files with 325 additions and 259 deletions

23
JsonParser.cpp Normal file
View File

@ -0,0 +1,23 @@
/*
* malloc-free JSON parser for Arduino
* Benoit Blanchon 2014
* MIT License
*/
#include "JsonParser.h"
bool JsonParserBase::parse(char* jsonString)
{
buffer = jsonString;
if (JSMN_SUCCESS != jsmn_parse(&parser, jsonString, tokens, maxTokenCount))
return false;
// Add null termination to each token
for (int i = 1; i < parser.toknext; i++)
{
buffer[tokens[i].end] = 0;
}
return true;
}