mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Updated README.md
This commit is contained in:
		| @@ -1,11 +1,11 @@ | |||||||
| An efficient JSON parser for Arduino | Arduino JSON library - Parser | ||||||
| ==================================== | ============================= | ||||||
|  |  | ||||||
| This library is an thin C++ wrapper around the *jsmn* tokenizer: http://zserge.com/jsmn.html | This library is an thin C++ wrapper around the *jsmn* tokenizer: http://zserge.com/jsmn.html | ||||||
|  |  | ||||||
| It's design to be very lightweight, works without any allocation on the heap (no malloc) and supports nested objects. | It's design to be very lightweight, works without any allocation on the heap (no malloc) and supports nested objects. | ||||||
|  |  | ||||||
| It has been written with Arduino in mind, but it isn't linked to Arduino libraries so you can use this library on any other C++ project. | It has been written with Arduino in mind, but it isn't linked to Arduino libraries so you can use this library in any other C++ project. | ||||||
|  |  | ||||||
|  |  | ||||||
| Features | Features | ||||||
| @@ -13,33 +13,26 @@ Features | |||||||
|  |  | ||||||
| * Based on the well-proven [jsmn](http://zserge.com/jsmn.html) tokenizer | * Based on the well-proven [jsmn](http://zserge.com/jsmn.html) tokenizer | ||||||
| * Supports nested objects | * Supports nested objects | ||||||
| * Works with fixed memory allocation : no `malloc()` | * Elegant API, very easy to use  | ||||||
| * Low footprint | * Fixed memory allocation (no malloc) | ||||||
|  | * Small footprint | ||||||
| * MIT License | * MIT License | ||||||
|  |  | ||||||
|  |  | ||||||
| Example | Example | ||||||
| ------- | ------- | ||||||
|  |  | ||||||
|     char json[] = "{\"Name\":\"Blanchon\",\"Skills\":[\"C\",\"C++\",\"C#\"],\"Age\":32,\"Online\":true}"; |     char json[] = "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}"; | ||||||
|  |  | ||||||
|     JsonParser<32> parser; |     JsonParser<32> parser; | ||||||
|  |  | ||||||
|     JsonHashTable hashTable = parser.parseHashTable(json); |     JsonHashTable root = parser.parseHashTable(json); | ||||||
|  |  | ||||||
|     if (!hashTable.success()) |     char* sensor = root.getString("sensor"); | ||||||
|     { |  | ||||||
|         return; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     char* name = hashTable.getString("Name"); |  | ||||||
|  |  | ||||||
|     JsonArray skills = hashTable.getArray("Skills"); |  | ||||||
|  |  | ||||||
|     int age = hashTable.getLong("Age"); |  | ||||||
|  |  | ||||||
|     bool online = hashTable.getBool("Online"); |  | ||||||
|  |  | ||||||
|  |     long time = root.getLong("time"); | ||||||
|  |      | ||||||
|  |     JsonArray coords = root.getArray("data"); | ||||||
|  |  | ||||||
|  |  | ||||||
| How to  use ? | How to  use ? | ||||||
| @@ -49,13 +42,15 @@ How to  use ? | |||||||
|  |  | ||||||
| Download the library and extract it to: | Download the library and extract it to: | ||||||
|  |  | ||||||
|     <your Arduino Sketch folder>/libraries/ArduinoJsonParser |     <your Arduino Sketch folder>/libraries/ArduinoJson | ||||||
|  |  | ||||||
| ### 2. Import in your sketch | ### 2. Import in your sketch | ||||||
|  |  | ||||||
| Just add the following line on the top of your `.ino` file: | Just add the following lines at the top of your `.ino` file: | ||||||
|  |  | ||||||
|     #include <JsonParser.h> |     #include <JsonParser.h> | ||||||
|  |  | ||||||
|  |     using namespace ArduinoJson::Parser; | ||||||
|      |      | ||||||
| ### 3. Create a parser | ### 3. Create a parser | ||||||
|  |  | ||||||
| @@ -233,7 +228,7 @@ Code size | |||||||
|  |  | ||||||
| Theses tables has been created by analyzing the map file generated by AVR-GCC after adding `-Wl,-Map,foo.map` to the command line. | Theses tables has been created by analyzing the map file generated by AVR-GCC after adding `-Wl,-Map,foo.map` to the command line. | ||||||
|  |  | ||||||
| As you'll see the code size if between 1680 and 3528 bytes, depending on the features you use. | As you'll see the code size is between 1680 and 3528 bytes, depending on the features you use. | ||||||
|  |  | ||||||
| ### Minimum setup | ### Minimum setup | ||||||
|  |  | ||||||
| @@ -406,11 +401,4 @@ As you'll see the code size if between 1680 and 3528 bytes, depending on the fea | |||||||
|         <td>TOTAL</td> |         <td>TOTAL</td> | ||||||
|         <td>710</td> |         <td>710</td> | ||||||
|     </tr> |     </tr> | ||||||
| </table> | </table> | ||||||
|  |  | ||||||
|  |  | ||||||
| Links |  | ||||||
| ----- |  | ||||||
|  |  | ||||||
| * [The project for which I made me this library](http://blog.benoitblanchon.fr/rfid-payment-terminal/) |  | ||||||
| * [Blog post on the motivation for this library](http://blog.benoitblanchon.fr/arduino-json-parser/) |  | ||||||
							
								
								
									
										17
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								README.md
									
									
									
									
									
								
							| @@ -7,7 +7,8 @@ It's design to be very lightweight, works without any allocation on the heap (no | |||||||
|  |  | ||||||
| It has been written with Arduino in mind, but it isn't linked to Arduino libraries so you can use this library in any other C++ project. | It has been written with Arduino in mind, but it isn't linked to Arduino libraries so you can use this library in any other C++ project. | ||||||
|  |  | ||||||
| # Features | Features | ||||||
|  | -------- | ||||||
|  |  | ||||||
| * JSON decoding: [more details here](/JsonParser/) | * JSON decoding: [more details here](/JsonParser/) | ||||||
| * JSON encoding: [more details here](/JsonGenerator/) | * JSON encoding: [more details here](/JsonGenerator/) | ||||||
| @@ -16,7 +17,8 @@ It has been written with Arduino in mind, but it isn't linked to Arduino librari | |||||||
| * Small footprint | * Small footprint | ||||||
| * MIT License | * MIT License | ||||||
|  |  | ||||||
| # Feature comparison | Feature comparison | ||||||
|  | ------------------ | ||||||
|  |  | ||||||
| | Library      | Memory allocation | Nested objects | Encoding | Parser size | Encoder size | | | Library      | Memory allocation | Nested objects | Encoding | Parser size | Encoder size | | ||||||
| | ------------ | ----------------- | -------------- | -------- | ----------- | ------------ | | | ------------ | ----------------- | -------------- | -------- | ----------- | ------------ | | ||||||
| @@ -34,7 +36,8 @@ In each case the target platform was an Arduino Duemilanove and Arduino IDE 1.0. | |||||||
|  |  | ||||||
| Links: [json-arduino](https://github.com/not404/json-arduino), [aJson](https://github.com/interactive-matter/aJson)  | Links: [json-arduino](https://github.com/not404/json-arduino), [aJson](https://github.com/interactive-matter/aJson)  | ||||||
|  |  | ||||||
| # Testimonials | Testimonials | ||||||
|  | ------------ | ||||||
|  |  | ||||||
| From Arduino's Forum user `jflaplante`: | From Arduino's Forum user `jflaplante`: | ||||||
| > I tried the  [aJson and json-arduino] before trying your library. I always ran into memory problem after a while.  | > I tried the  [aJson and json-arduino] before trying your library. I always ran into memory problem after a while.  | ||||||
| @@ -44,4 +47,10 @@ From Arduino's Forum user `gbathree`: | |||||||
| > Thanks so much - this is an awesome library!  If you want to see what we're doing with it - the project is located at www.photosynq.org. | > Thanks so much - this is an awesome library!  If you want to see what we're doing with it - the project is located at www.photosynq.org. | ||||||
|  |  | ||||||
| From StackOverflow user `thegreendroid`: | From StackOverflow user `thegreendroid`: | ||||||
| > It has a really elegant, simple API and it works like a charm on embedded and Windows/Linux platforms. We recently started using this on an embedded project and I can vouch for its quality. | > It has a really elegant, simple API and it works like a charm on embedded and Windows/Linux platforms. We recently started using this on an embedded project and I can vouch for its quality. | ||||||
|  |  | ||||||
|  | Links | ||||||
|  | ----- | ||||||
|  |  | ||||||
|  | * [The project for which I made me this library](http://blog.benoitblanchon.fr/rfid-payment-terminal/) | ||||||
|  | * [Blog post on the motivation for this library](http://blog.benoitblanchon.fr/arduino-json-parser/) | ||||||
		Reference in New Issue
	
	Block a user