-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues when adding values to firebase database #704
Comments
I found this with a solution that I should wrap my JSON into single quotes: Can I do it automatically with this json library? |
More input; if I wirte this code:
I get output Now if I use libcurl from cmd, with input: I get the exact same output ( |
No, adding single quotes around a JSON text is not supported by the library, but can be done without problems in client code. Unfortunately, I do not understand your third comment #704 (comment). What is the issue? |
Thank you very much for responding. I'm currently pulling my hair off because of this. Yes as you can see from this post it doesn't seem to need those single quotes anymore.. But here is what I got: So, giving this exact input to my curl.exe straight from terminal (windows CMD) works; It inputs no problem; also giving raw string from my C++ program like this works; but then when I try to feed it with your json library output, it doesn't work: and on top of that both "{\"pi\":1.41,\"pi2\":2.82}" and j.dump() seem exactly the same (at least to my eye) when printed out from my C++ program. and more info: I'm using google firebase and its REST api documented here https://firebase.google.com/docs/reference/rest/database/ |
That's weird. Can you make sure the strings are identical to the byte? There may be some subtle issue with escaping. |
Can you point me a way to make clear they are identical? Can I just memcmp with j.dump().data() and string.data() ? |
Well, storing both in a |
I might miss something here, but are you passing a |
@nlohmann the strings are the same @theodelrieu yes it does, without warnings. and now as you ask, yes, it works if I put in j.dump().data() Now the firebase response is "No data supplied" :( nvm, it works, you can close it. Thanks @theodelrieu for opening my eyes. |
@jussihi It's because of varargs I guess, that's weird, glad it fixes your problem! |
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:
The text was updated successfully, but these errors were encountered: