Code Monkey home page Code Monkey logo

Comments (13)

mobizt avatar mobizt commented on August 25, 2024

First, try to edit library in this issue.
Try to push this string

String json = "{\"name\":\"iot4\",\"datetime\": \"2019/03/22 11\:27\:59\",\"accelX\": 0.067871,\"accelY\": -0.026367,\"accelZ\":-0.928223,\"temp\": 26.65,\"humid\": 93248.09}";

It should ok. If it's ok, check how you create json string e.g. from ArduinoJson object using printTo or create as string as above string.

Not recommend to include colon (:) i.e. 11:27:59 in database because it used as key/value separator in json object. I use escape character, back slash before colon (:) to make it can parse as :

from firebase-esp8266.

blotfi avatar blotfi commented on August 25, 2024

I use doc Arduinojson it is not a problem.
As I said I can send it if there is less characters
There is a limitation somewhere I need to bypass

from firebase-esp8266.

mobizt avatar mobizt commented on August 25, 2024

My library sends string as payload to server without any modification as I ask you to send json string of above post. If it works, the problem is in json object you created. You need to check the value you add to root and read it back.

from firebase-esp8266.

mobizt avatar mobizt commented on August 25, 2024

Can you show example code for me to test?

from firebase-esp8266.

blotfi avatar blotfi commented on August 25, 2024

from firebase-esp8266.

blotfi avatar blotfi commented on August 25, 2024

I mean instead of doing
char output[128]; serializeJson(doc, output); Firebase.pushJSON(firebaseData, "/data", output); }

from firebase-esp8266.

mobizt avatar mobizt commented on August 25, 2024

You need to assign macro ARDUINOJSON_USE_DOUBLE before include ArduinoJson.h like this

#define ARDUINOJSON_USE_DOUBLE 1
#include <ArduinoJson.h>

Here is the example to test

Try to push json data

DynamicJsonDocument doc(256);
double val1 = -0.00000001; //max 8 decimal places
double val2 = 321.12345678; //max 8 decimal places
doc["val1"] = val1;
doc["val2"] = val2;

char output[128];
memset(output, 0, 128);
serializeJson(doc, output);
Firebase.pushJSON(firebaseData, "/data", output);

Try to read json data back

Firebase.getJSON(firebaseData, "/data");

DynamicJsonDocument _doc(256);
deserializeJson(_doc, firebaseData.jsonData());
double _val1 = _doc["val1"];
double _val2 = _doc["val2"];
Serial.println(_val1,8);
Serial.println(_val2,8);

from firebase-esp8266.

blotfi avatar blotfi commented on August 25, 2024

It seems that you did not understood me or that I didn't explain well.
Everything is working fine, it was my fault
char output[128];
is not enough
char output[150];
is ok

I just asked if there is another way instead of going through a fixed buffer, perhaps using String

from firebase-esp8266.

mobizt avatar mobizt commented on August 25, 2024

I know as much as information you provide, the only part of your incompleted code then I need to build the basic test and extend the possibility to handle maximum decimal places for ArduinoJSON.

For String object it can because it has write function that ArduinoJson used for modify string.

String output="";
serializeJson(doc, output);

from firebase-esp8266.

blotfi avatar blotfi commented on August 25, 2024

thanks

from firebase-esp8266.

Proxcentaur avatar Proxcentaur commented on August 25, 2024

I got this error when I was trying to put that code:
no matching function for call to 'FirebaseESP32::pushJSON(FirebaseData&, StringSumHelper&, ArduinoJson::JsonObject&)'

from firebase-esp8266.

mobizt avatar mobizt commented on August 25, 2024

@Proxcentaur The library APIs were changed sofar.

You need to provide the FirebaseJson object to the pushJSON function.

For example.

FirebaseJson json;

json.add("data1",100); //add (new) data
json.set("data2/new", "test"); //set (replace or create new) the data

Firebase.pushJSON(firebaseData, "your_node_path", json);

from firebase-esp8266.

Proxcentaur avatar Proxcentaur commented on August 25, 2024

@Proxcentaur The library APIs were changed sofar.

You need to provide the FirebaseJson object to the pushJSON function.

For example.

FirebaseJson json;

json.add("data1",100); //add (new) data
json.set("data2/new", "test"); //set (replace or create new) the data

Firebase.pushJSON(firebaseData, "your_node_path", json);

thank you, it works!

from firebase-esp8266.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.