skip to Main Content

enter image description here

I want to import json file in Realtime Database of firebase but showing error "Invalid JSON file" even though the json in a file is valid and my quota limit has not been disabled yet.My file size is about360 MB .How should I import the json file ?

2

Answers


  1. Chosen as BEST ANSWER

    Frederic Chang Explained very well .But as the json file get overwriten each time you upload So to reduce the manual work of creating each parent node and importing the data I have used the following code.

        $json_data = file_get_contents(getcwd()."/../assets/rescuelane-simulator-default-rtdb-export.json");
    
    foreach ($json_data as $key => $value) {
    
      $this->myfirebase->firebase()->createDatabase()->getReference("users/".$key)->set($value);
    
    }
    

  2. I noticed that
    Size of a single write request to the database :

    1. 256 MB from the REST API;

    2. 16 MB from the SDKs.

    If you upload JSON files, you have to separate them into multi JSON files (16MB) and upload each one manually.

    https://firebase.google.com/docs/database/usage/limits

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search