I downloaded the ArduinoJson library, installed it into the libraries and tried to run the generator example. I get a message “error compiling”.

The message detail is …Arduino: 1.5.4 (Windows NT (unknown)), Board: “Arduino Uno”

JsonGeneratorExample.cpp.o: In function setup': C:\Program Files (x86)\Arduino/JsonGeneratorExample.ino:14: undefined reference to ArduinoJson::JsonBuffer::createObject()’… …

I tried searching the forum and the web to try and figure out where I’m going wrong…beats me… I am not able to figure out what’s going wrong.

What am I missing?

Thank you for the time!


Without seeing your code it is hard to know if you have a typo.


This is directly the code from the examples directory. The code is given below…

// Copyright Benoit Blanchon 2014
// MIT License
// Arduino JSON library
// GitHub - bblanchon/ArduinoJson: 📟 JSON library for Arduino and embedded C++. Simple and efficient.

#include <ArduinoJson.h>

void setup() {

StaticJsonBuffer<200> jsonBuffer;

JsonObject& root = jsonBuffer.createObject();
root[“sensor”] = “gps”;
root[“time”] = 1351824120;

JsonArray& data = root.createNestedArray(“data”);
data.add(48.756080, 6); // 6 is the number of decimals to print
data.add(2.302038, 6); // if not specified, 2 digits are printed

// This prints:
// {“sensor”:“gps”,“time”:1351824120,“data”:[48.756080,2.302038]}


// This prints:
// {
// “sensor”: “gps”,
// “time”: 1351824120,
// “data”: [
// 48.756080,
// 2.302038
// ]
// }

void loop() {
// not used in this example

Adding on, …do I need to #include <JsonGenerator.h> and not #include <arduinoJson.h> ? Any one can point me to a link where I can download JsonGenerator.h?

As a web application (and other) software developer, I'm a fan of JSON. It's a great and standardized way to pass around data, particularly when javascript is involved (for obvious reasons).

That said, I don't see how anyone could contemplate using such a format for a microcontroller with limited RAM like the Arduino. Unless your Arduino application is fairly small (such that variable and array usage is at a minimum), the need for the larger buffers and everything else involved in parsing what could be sent and received as a simple byte string is massive overhead for an 8-bit microcontroller with little RAM to spare.

Sure - if you have a Mega with a ram expansion, or you have other means to store and work with the data, it might make sense - but you still are left with the extra work (and code - even in a library) needed to parse and use the data.

I see no problem using such a library with a 32 bit microcontroller or SoC (like a Yun or similar), where RAM isn't a problem, nor is processor speed - but it seems out of place on an 8-bit system with limited RAM.

Where have you the library installed?


The library is installed at C:\Program Files (x86)\Arduino\libraries. (windows 8.1, Arduino V 1.5.4)

The library has been successfully added in the IDE. I am able to see the same.

Based on the question regarding location and the error message, I had a feeling the issue was more to do with the location or version. Did a clean uninstall, deleted folders with reference to Arduino.

Reinstalled V 1.6.3, added ArduinoJson ZIP library,(under include library, option not available in the previous version) and let Arduino decide the location !

And hey presto.. the program is working fine now. Compiles and executes :)

@cr0sh - It was more out of curiosity, I was exploring Json. Ya, I agree maybe too heavy for an 8 bit micro.