Skip to content

Issues when adding values to firebase database #704

Description

@jussihi

Hello, I'm having some issues adding values to a firebase database using this json library.

The test["pi"] adds into the firebase very well, but then when I try to add the test["pia"]["pia"] it responds with a "error" : "Invalid data; couldn't parse JSON object, array, or value."

Here is my code:

`json test;
 test["pi"] = 1.41;
 test["pia"]["pia"] = 2.0; 
 CURLcode res;
 struct curl_slist *headers = NULL;
 headers = curl_slist_append(headers, "Content-Type: application/json");
 curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
 curl_easy_setopt(curl, CURLOPT_URL, "https://aaaa.firebaseio.com/bbbb.json");
 curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT");
 curl_easy_setopt(curl, CURLOPT_POSTFIELDS, moi.dump());
 res = curl_easy_perform(curl);
 std::cout << res << std::endl;
 curl_slist_free_all(headers);
 curl_easy_cleanup(curl);`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions