mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			429 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			429 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * 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;
 | |
| } |