• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Arduino_JSON (arduino) vs ArduinoJson (Benoit)

Q&A Forum › Category: ESP32 › Arduino_JSON (arduino) vs ArduinoJson (Benoit)
0 Vote Up Vote Down
Jose Fernandez asked 3 years ago

Hi Sara,
I would appreciate your comments about this issue
Background: 
   1-  In page 66 Build_Web_Servers_ESP32_ESP8266_V2.pdf you suggest installing   Arduino_JSON
 
   2- In tutorial  https://randomnerdtutorials.com/esp32-http-get-post-arduino/
       you wrote  “You also need to install the Arduino_JSON library”
 
 But later in the same tutorial (https://randomnerdtutorials.com/esp32-http-get-post-arduino/)  
the code for json request is 
// If you need an HTTP request with a content type: application/json, use the following:
//http.addHeader(“Content-Type”, “application/json”);
//int httpResponseCode = http.POST(“{\”api_key\”:\”tPmAT5Ab3j7F9\”,\”sensor\”:\”BME280\”,\”value1\”:\”24.25\”,\”value2\”:\”49.54\”,\”value3\”:\”1005.14\”}”); 
Code that I do not found user friendly.
 
Looking for alternatives I found this code 
// Prepare JSON document
DynamicJsonDocument doc(2048);
doc[“hello”] = “world”;
// Serialize JSON document
String json;
serializeJson(doc, json);
WiFiClient client; // or WiFiClientSecure for HTTPS
HTTPClient http;
// Send request
http.begin(client, “http://httpbin.org/post”);
http.POST(json);
 
But it seems that this code does not work Arduino_JSON
 
My questions:
1- What is your opinion about replacing Arduino_JSON with ArduinoJson.
2- Are there any licensing issues?
3- How to implement a more friendly code for a POST request with json and Arduino_JSON library
 
Thanks in advance for your help
 

Question Tags: WEB SERVER JSON
1 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
 
Arduino_JSON is one of the most simple libraries for JSON. It works fine for simple projects. It works for me for most of the projects without adding much complexity because I don’t need to do complex stuff with JSON objects.
 
AduinoJSON has more advanced functions. You can find  many examples and explanations about how to use it on the website: https://arduinojson.org/
 
You can use one or the other. It will depend on your preferences. You just need to take into account, that one library is not compatible with the other.
 
Regards,
Sara
 

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.