ArduinoJson with ESP-IDF

Hi there!

I would like to use the ArduinoJson library with my ESP32 project built with the ESP-IDF framework.
I was able to “install” it for my project with the Library Browser but then LDF doesn’t recognize it as a compatible library. Indeed, ArduinoJson is tagged only for the Arduino framework.
I wonder why as this library doesn’t require Arduino (unlike the name says).

So, is there any trick to use the useful library management from PlatformIO with an ESP-IDF and ArduinoJson project?

Thanks,
MatPy

If that’s true then set lib_compat_mode = off (docs) to make PlatformIO ignore a mismatch between what the library wants in terms of framework and what you’re compiling for.

You may however need to define some macros because ArduinoJSON looks for the ARDUINO macro defined when compiling for Arduino to determine the value of another macro. Might be necessary, might not be.

Thanks! I should have seen this option. With compatibility check disabled, everything works well.

Did you have to do build_flags = -D ARDUINOJSON_EMBEDDED_MODE=1?

PS: PR created Advertise ESP-IDF compatibility in library.json by maxgerhardt · Pull Request #1490 · bblanchon/ArduinoJson · GitHub.

Sorry, I didn’t see your answer. No I’m not using this flag, that’s working without it. I’m not sure what’s the utility of this but I will enventually investigate.
Also, thank you for the correction and the PR on ArduinoJson’s Github.Hope it will be released soon!