How to used JSON file in c++

Hi all, could any one tell me how to write a json file in c++
this is my json file and I want to print it using Serial.print() function

{
  "records": [
    {
      "fields": {
        "Sensor Type": "Temp",
        "Value": 150000
      }
    }
  ]
}

Hi @mo7ammed-saleh
Use the json arduino library.

RV mineirin

Not sure what you mean?

Serial.println("{\"records\": [{\"fields\":{\"Sensor Type\":\"Temp\",\"Value\": 150000}}]}");

Would work

Hi @mo7ammed-saleh

If it's version 6.0 you can use it like this:

String toFB;
serializeJson(myjson, toFB);
Serial.println( toFB);

RV mineirin

Thanks

thanks, I will look at it

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.