Skip to content

Using the library with Arduino

Etienne Lachance edited this page Aug 19, 2016 · 11 revisions

This library is primarily design to be used with the Arduino IDE and therefore has a simplified setup procedure for that environment. If you don't use the Arduino IDE, please read [Using the library without Arduino](Using the library without Arduino).

Install the library

For Arduino 1.6.x and above

ArduinoJson is available in Arduino's Library Manager. You can automatically install it from there.

Note: if ArduinoJson doesn't appear in Library Manager, or if only old versions are listed, try to delete the local cache. For example, on Windows, you need to delete:

  • %LOCALAPPDATA%\Arduino15\library_index.json
  • %LOCALAPPDATA%\Arduino15\library_index.json.tmp.gz

You don't even need to close Arduino, just re-open the library manager.

For older Arduino IDE

You needed to download the zip package and extract it to:

<your Arduino Sketch folder>/libraries/ArduinoJson

Then restart the Arduino IDE.

NOTE: There are two packages the standard and the "old-layout". You need to use the "old-layout" for Arduino 1.0.X, Energia and other alternative IDE.

For Visual Micro / Visual Studio 2015 / Atmel Studio

You need the latest version (January 2016 or later) of Visual Micro installed for Visual Studio or Atmel Studio.

Run the examples sketches

Click File / Example / ArduinoJson.

Screen capture of Arduino IDE

Use the library in your sketches

Just add the following line at the top of your program:

#include <ArduinoJson.h>

Then follow the instructions:

  1. [Decoding JSON](Decoding JSON)
  2. [Encoding JSON](Encoding JSON)

Clone this wiki locally