How to import a .json file to Firebase Database? - json

I tried a few times via the web UI, but first the file wasn’t shown to me in the explorer and when i finally got around that and uploaded my .json there was one entry:
error: "Auth token is expired“
i just want to import that .json file, how does one do that?

The Auth Token probably expired because you were on the page too long before you uploaded it. Keep trying and it will work, given that the .json is correctly formatted.

Related

Remove a local JSON file by code in flutter

I wrote an app that fills a database from a local JSON file, and the app doesn't use this file after that.
Is there a way to remove it by code (by deleting it for example)?
Thanks.

Published https://docs.google.com/spreadsheets redirects to other URL (CSV data)

We auto-publish a Google Docs Spreadsheet (one tab as CSV). Google docs is providing a fixed URL that refers to the CSV. We import this CSV in another tool for product data import.
Suddenly this URL is redirected by Google Spreadsheet. If we go again in "File/Publish To The Internet" we can the same URL for that CSV.
Question: How can get the URL without redirection again?
Error: Source file
https://docs.google.com/spreadsheets/d/e/2PACX-1vTQsBEmvOwFwxORMqYg2N6LzzYqdqsdDCjxqsdqsdH72gdMCP4xrs1lsN37RO4h1-rjJsQ/pub?gid=501162839&single=true&output=csv doesn't exist (HTTPS : File not found ! (HTTP/1.0 307 Temporary Redirect)). Please check the source file path.
In short, the collection process needs to follow the Location header. Depending how you're getting the CSV this might be simple or a pain. I collect CSVs using curl so just adding the -L switch is sufficient to make sure the incoming files are the CSV we're looking for instead of the HTML that we were getting without -L. Without knowing what utility or process you're using to download the CSV I can't be more specific, unfortunately.

Firebase: Exporting JSON Unable to export The size of data exported at a single location cannot exceed 256 MB

I used to download a node of firebase real-time database every day to monitor some outputs by exporting the .JSON file for that node. The JSON file itself is about 8MB.
Recently, I started receiving an error:
"Exporting JSON Unable to export The size of data exported at a single location cannot exceed 256 MB.Navigate to a smaller part of the database or use backups. Read more about limits"
Can someone please explain why I keep getting this error, since the JSON file I exported just yesterday was only 8.1 MB large.
I probably solved it! I disabled CORS addon in Chrome and suddenly it worked to export :)
To get rid of this, you can use Postman's Import feature because downloading a large JSON file sometimes faces failure in the middle of the way using a browser from the dashboard of the firebase. You can put the traditional cUrl commands on it. You just need to click save the response after the response is reached. To get rid of complex authentication complexity, you make the rule permission of the firebase database to read:true until the download is complete thought you need to ensure security for this. Postman also needs sometimes to preview the JSON even freezing the UI but you don't need to be bothered with it.

Failing to Upload Large JSON file to Firebase Real Time Database

I have a 1GB json file to upload to Firebase RTDB but when I press Import, it's loading for a while and then I get this Error:
There was a problem contacting the server. Try uploading your file again.
I have tried to upload a 30mb file and everything is ok.
It sounds like your file it too big to upload to Firebase in one go. There are no parameters to tweak here, and you'll have to use another means of getting the data into the database.
You might want to give the Firebase-Import library ago, the Firebase CLI's database:set command, or write your own import for your file format using the Firebase API.

How do I reference a csv file in jsbin

I am trying to recreate this d3 example in JSBIN
d3.csv("bar-data.csv", function(error, data) {
...
})
I am trying to reference the csv file but it does seem to be able to access the csv file:
d3.csv("http://bl.ocks.org/d3noob/raw/8952219/d45ad0a7caf9c499d1a1e975b3760c90f5321072/bar-data.csv", function(error, data) {
...
I have tried uploading the file to dropbox and using that link but that alos does not work.
Can anyone advise how I can get these urls to the csv file to work. or offer another way for me to try and recreate this example? The reason I want to recreate it is so I can modify and test it with other data and just generally do more with it....
NOTE Another option is to try jsfiddle, which I will, but I would like to use jsbin.
EDIT1
here is the JSFIDDLE using the dropbox link to the csv file. this is the error I get in firefox:
https://www.dropbox.com/s/plpl0yjxze9elpd/bar-data.csv 200 OK 966ms d3.v3.min.js (line 1)
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.dropbox.com/s/plpl0yjxze9elpd/bar-data.csv. (Reason: CORS header 'Access-Control-Allow-Origin' missing).
TypeError: data is undefined
EDIT2
One way is to not read in from the csv at all and have it in an array already , which takes a while to get it to the format I want, but I would still like to be able to get it to work by reading in the csv file.
data = [{"date":"2013-01","value":53},{"date":"2013-02","value":165},{"date":"2013-03","value":269},{"date":"2013-04","value":344},{"date":"2013-05","value":376},{"date":"2013-06","value":410},{"date":"2013-07","value":421},{"date":"2013-08","value":405},{"date":"2013-09","value":376},{"date":"2013-10","value":359},{"date":"2013-11","value":392},{"date":"2013-12","value":433},{"date":"2014-01","value":455},{"date":"2014-02","value":478}]
FIDDLE
JSBIN
It's going to be hard to find somewhere to drop that file that won't hit you with CORS restrictions. The easiest thing to do would just be to download the code and run it locally from a file.
If you really want to do it all in the browser, Plunker would be a good choice. It's similar to jsfiddle or jsbin, but allows you to create any type of file you want in your project. So just create a csv file there and paste the data in.