Mastering ArduinoJson (The Book + Code Samples)

Retired

This book is no longer available for sale.

Mastering ArduinoJson

Efficient JSON serialization for embedded C++

About the Book

Who is this book for?

If you never used ArduinoJson, you will appreciate this book because it guides you through your learning. It starts with the basic usage of the library and increments the complexity step by step. The last chapter analyzes several example projects and explains the design choices. It is a much better way to learn than blindly copy-pasting the examples.

If you are already using ArduinoJson, you will learn how to get the best performance and the most straightforward code. You will discover that many examples found on the Internet are suboptimal and even dangerous. The sample projects will give you a sense of how the library should be used and will give you a new perspective on your projects.

What knowledge is required?

This book is not a course on Arduino or embedded programming. It assumes a small experience with Arduino; you do not need to be a master, just to be able to compile and run a simple sketch.

Many Arduino users lack some of the fundamental principles of C++, that is why this book starts with a quick refresher. However, it does not pretend to teach C++ from scratch; it assumes the knowledge of another object-oriented programming language, such as C# or Java. There is much material to learn how to program with Arduino, but most of them miss essential parts that are crucial in your development career. This chapter covers the holes left by the other Arduino books, that is why I called it "The Missing C++ Course."

What is in the book?

This book is not a compilation of resource already available online. All the content is new, and nothing was recycled from existing documents.

It contains many new code samples and original illustrations. 

Contrary to the documentation on arduinojson.org, which grew organically from the GitHub wiki, this book is the result of several months of continuous work, starting from scratch. The result is a coherent and complete learning material.

How is the book written?

This book is optimized for fast and easy reading. It uses short sentences, active voice, and conversational style, to ensure a smooth understanding, even for non-English speakers.

The book is well balanced between text and code. Code snippets are short and focused, so there are easy to digest, but the complete programs are available in the zip file.

The book is designed to be read from cover to cover without a computer, so it is the perfect format to learn in your commute. It is also well segmented, so you can quickly skim when you are looking something in particular.

Why buy this book?

By buying this book, you encourage the development of high-quality libraries. By providing a (modest) source of revenue for open-source developers like me, you ensure that the libraries that you rely on are continuously improved and won't be abandoned after a year.

The current version of the book covers ArduinoJson 5.13, but you will have access to newer revisions as soon as they exist. You only have to buy this book once, you won't have to pay for upgrades.

About the Author

Benoît Blanchon
Benoît Blanchon

Benoit has 15 years of professional experience in C++ and C#.

He worked in Microwave Vision Group, QuasarDB, and Devialet.

He focuses on writing clean code without sacrificing the performance.

His blog Good Code Smell is online since 2014.

As an open-source developer, he is known as the author Winpooch and ArduinoJson.

Reader Testimonials

Pierre Olivier Théberge
Pierre Olivier Théberge

Just bought your Arduino JSON book on Amazon. I learned more in the hour it took me for reading your book than in 3 courses in University... I wanted you to know that if you write a C++ book for Arduino or any other book, I will be pleased to purchase those as well.

Daniel Travis
Daniel Travis

Mr. Blanchon's book is one of the best JSON books available to date! It gets right to the code without playing in tall grass, letting new developers get right to the good stuff.

Avishek Hardin
Avishek Hardin

An excellent in-depth book that combines Micro-controllers and JSON instructions. This ebook was exactly what I needed to get started with the JSON, Arduino & ESP

Douglas S. Basberg
Douglas S. Basberg

The short C++ section was a great refresher. The practical use of ArduinoJson in small embedded processors was just what I needed for my home automation work. Certainly worth having! Thank you for both the book and the library.

Anonymous
Anonymous

I especially loved the explanations on C++ syntax. A lot of things snapped into place in my head I wasn't expecting. Well done and thank you! Original reason I bought the book was to support the development and also to find out the design decisions on the ArduinoJson syntax which TBH got me interested in learning C++11/14 for my Arduino projects.

Darryl Jewiss
Darryl Jewiss

Great book for learning how to use AruinoJson. But also a good, quick course on C++ pointers, buffers etc.

Ron VanEtten
Ron VanEtten

I have been a casual user of the Arduino IDE for about 6 months, and tend to struggle with why I needed to define variables and constants in specific ways, and the general construction of programs in this environment. The book provides enough "why" to remove mystery from the organization of data and program spaces in the microcontroller environment to make me much more comfortable.

Ezequiel Pavón
Ezequiel Pavón

Excellent approach of the programming. It goes a step forward for the programmer in C++ and enforce some knowles. Highly recommended. Ezequiel from Argentina

Table of Contents

  1. Introduction
    1. About this book
    2. Introduction to JSON
    3. Introduction to ArduinoJson
    4. Summary
  2. The missing C ++ course
    1. Why a C ++ course?
    2. Stack, heap, and globals
    3. Pointers
    4. Memory management
    5. References
    6. Strings
    7. Summary
  3. Deserialize with ArduinoJson
    1. The example of this chapter
    2. Parse a JSON object
    3. Extract values from an object
    4. Inspect an unknown object
    5. Parse a JSON array
    6. Extract values from an array
    7. Inspect an unknown array
    8. The zero-copy mode
    9. Parse from read-only memory
    10. Parse from a stream
    11. Summary
  4. Serialize with ArduinoJson
    1. The example of this chapter
    2. Create an object
    3. Create an array
    4. Serialize to memory
    5. Serialize to a stream
    6. Duplication of strings
    7. Summary
  5. Advanced Techniques
    1. Introduction
    2. Filtering the input
    3. Deserializing in chunks
    4. JSON streaming
    5. Automatic capacity
    6. Fixing memory leaks
    7. Using external RAM
    8. Logging
    9. Buffering
    10. Custom readers and writers
    11. MessagePack
    12. Summary
  6. Inside ArduinoJson
    1. Why JsonDocument ?
    2. Inside JsonDocument
    3. Inside StaticJsonDocument
    4. Inside DynamicJsonDocument
    5. Inside JsonVariant
    6. Inside JsonObject
    7. Inside JsonArray
    8. Inside the parser
    9. Inside the serializer
    10. Miscellaneous
    11. Summary
  7. Troubleshooting
    1. Program crashes
    2. Deserialization issues
    3. Serialization issues
    4. Common error messages
    5. Log
    6. Ask for help
    7. Summary
  8. Case Studies
    1. Configuration in SPIFFS
    2. OpenWeatherMap on mkr1000
    3. Reddit on ESP8266
    4. JSON-RPC with Kodi
    5. Recursive analyzer
  9. Conclusion

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub