When you encounter a "No such file or directory" error it usually means you need to install the library that contains the missing file (in this case ArduinoJson.h).
Ideally the documentation for the code you are trying to compile will have instructions for installing dependencies. Sometimes the author did not make the effort to write this documentation and you'll need to go searching for the missing library.
Many Arduino libraries are in the Library Manager index, which makes them quite easy to install:
Library Manager installation
- (In the Arduino IDE) Sketch > Include Library > Manage Libraries.
- Wait for the download to finish.
- In the "Filter your search..." box, type your search query, in this case "ArduinoJson" would be appropriate.
- Scroll through the search results to find something that looks correct (in this case "ArduinoJson by Benoit Blanchon"), then click on it.
- Click "Install".
- Wait for installation to finish.
- Click "Close".
If you don't find the library you need in Library Manager you'll need to spend some time with your favorite search engine. Once you find the library and download it you'll need to install it.
.ZIP Installation
(In the Arduino IDE) Sketch > Include Library > Add .ZIP Library
Select the downloaded file (must be a .zip).
Click "Open".
The above installation instructions require the .zip file to have a specific folder structure. In some cases the library author has not been kind enough to provide the correct folder structure. If you get a "Zip doesn't contain a library" error message then you will need to do a manual installation of the library.
Manual Installation
- Unzip the downloaded file
- Browse through the unzipped folder until you find the library folder. This will either have a library.properties file and/or a .h file.
- Copy the library folder to {Sketchbook folder}/libraries. You can find the sketchbook folder in the Arduino IDE at File > Properties > Sketchbook location.
You will need to restart the Arduino IDE before the examples sketches for manually installed libraries will appear under the File > Examples menu.