Firebase-tools: firebase: database-push Syntax unclear

Created on 8 Jun 2017  Â·  10Comments  Â·  Source: firebase/firebase-tools

Hi, Iam trying to push using

firebase database:push \country -d {"country1" : "Armenia"}

It is giving me an error as follows:
Error: HTTP Error: 400, Invalid data; couldn't parse JSON object, array, or value.

What am I doing wrong? Please help.

Most helpful comment

hey @daverinnadesan , are you running windows? If so, you may need to do:
firebase database:push /country -d "{\"country1\" : \"Armenia\"}"

It's probably an issue with what windows views as an appropriate representation of JSON on the command line. See https://stackoverflow.com/questions/28648473/windows-curl-with-json-data-on-the-command-line

All 10 comments

You need to do: firebase database:push \country -d '{"country1" : "Armenia"}'

firebase database:push /country -d file.json ??

I am also having the problem. The suggested solutions don't work. Has anyone found a solution yet?

Yes, place the Json objects in individual quotes ' '

On Jun 19, 2017 4:45 PM, "daverinnadesan" notifications@github.com wrote:

I am also having the problem. The suggested solutions don't work. Has
anyone found a solution yet?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-tools/issues/368#issuecomment-309410390,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AE2PvtdEN8r5U2VUw8IREWVdXMuAu35pks5sFlhCgaJpZM4Nzk2I
.

I tried that but am still unsuccessful.

Here is my command:
=> firebase database:push /country -d '{"country1" : "Armenia"}'
This results in
=> Error: HTTP Error: 400, Invalid data; couldn't parse JSON object, array, or value.

I am running cli version 3.9.1

I used database.set. You could try that.

On Mon, Jun 19, 2017 at 5:28 PM, daverinnadesan notifications@github.com
wrote:

I tried that but am still unsuccessful.

Here is my command:
=> firebase database:push /country -d '{"country1" : "Armenia"}'
This results in
=> Error: HTTP Error: 400, Invalid data; couldn't parse JSON object,
array, or value.

I am running cli version 3.9.1

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-tools/issues/368#issuecomment-309418749,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AE2PvkLJByGMMgYhQfjX_c9QN3ehLsH-ks5sFmJLgaJpZM4Nzk2I
.

hey @daverinnadesan , are you running windows? If so, you may need to do:
firebase database:push /country -d "{\"country1\" : \"Armenia\"}"

It's probably an issue with what windows views as an appropriate representation of JSON on the command line. See https://stackoverflow.com/questions/28648473/windows-curl-with-json-data-on-the-command-line

Hi @laurenzlong, Thank you for your help. That was indeed the problem.

firebase database:set /import data.json This way works

I was working on windows:
and @laurenzlong answer works for me.

firebase database:push /country -d "{\"country1\" : \"Armenia\"}"

Was this page helpful?
0 / 5 - 0 ratings