Convert json exported from Firestore to be used in RS

As my database keeps growing, I am reaching certain limitations related with Firestore and the way it works. The fact that I can’t implement a valid search without reaching the quota of the free plan, and the way it handles the offline user is making me to think about workarounds to this.

As I update or increase with a few documents my database on a weekly basis, I am thinking about implementing a mixed database having most of my collections loaded through a json file because those documents won’t change, and some of the collections linked with Firestore. In order to achieve this, I obtained the json file from my project with “npm firestore-import-export” but the json that I have has a specific format that I guess has to be converted to be used as data source in RS.

This is an example of the json obtained from Firestore:

{
  "__collections__": {  
    "metodos": {
      "bastien2": {
        "subtitle": "Nivel 2",
        "image": "./images/metodos/bastien2_cover.png",
        "sheetMusic": "",
        "artist": "",
        "name": "Piano básico de Bastien",
        "__collections__": {
          "preloads": {
            "01_Palmear_p4_5": {
              "artist": "Pág. 4-5",
              "preloadLink": "",
              "name": "1. Palmear",
              "date": 1587933280001,
              "image": "./images/metodos/bastien2.png",
              "subtitle": "Forma binaria",
              "sheetMusic": "",
              "__collections__": {}
            },
            "02_Escalando_p8": {
              "artist": "Pág. 8",
              "date": 1587933280001,
              "name": "2. Escalando la montaña",
              "image": "./images/metodos/bastien2.png",
              "preloadLink": "",
              "sheetMusic": "",
              "subtitle": "Escala de Do",
              "__collections__": {}
            },
          }
        }
      },
      "hanon_elPianistaVirtuoso": {
        "image": "",
        "subtitle": "",
        "sheetMusic": "",
        "name": "Hanon. El pianista virtuoso",
        "artist": "",
        "__collections__": {
          "preloads": {
            "01_Ejercicio1": {
              "subtitle": "Fácil (3b)",
              "preloadLink": "",
              "date": 1604858643190,
              "image": "./images/metodos/hanon.png",
              "sheetMusic": "",
              "artist": "Hanon",
              "name": "Ejercicio nº 1",
              "__collections__": {}
            },
            "02_Ejercicio2": {
              "preloadLink": "",
              "name": "Ejercicio 2",
              "sheetMusic": "",
              "date": 1606749731850,
              "artist": "Hanon",
              "subtitle": "Fácil (3b)",
              "image": "./images/metodos/hanon.png",
              "__collections__": {}
            }
          }
        }
      }
    }
  }
}

Obviously when I load that json as data source in RS it does not recognize it how it should:

How should I proceed to convert that json into a proper format? I hope there is an automated way so I don’t have to do it manually.

Thank you!

Ok. I have been manually converting the json and obviously I had to remove any reference to subcollections and add “document_key” in the first line where the document_id is written. Now RS takes the json perfectly:

[
  { "document_key": "N01_1_Rocking",
    "date": 1587933289000,
    "preloadLink": "./follow/follow.html?d:1bvz30quo6zc5hr/N1_1_Rocking.js",
    "artist": "",
    "sheetMusic": "",
    "name": "1. Rocking",
    "image": "",
    "title": "Nivel 1. Mano derecha. Do central.",
    "musicStyle": "Pop/Rock",
    "subtitle": "Nivel 1",
    "level": "Elemental",
  },
  { "document_key": "N01_2_Primavera",
    "preloadLink": "",
    "subtitle": "Nivel 1",
    "sheetMusic": "",
    "level": "Elemental",
    "artist": "A. Vivaldi",
    "image": "./images/paraEmpezar/N1_2_Vivaldi.jpeg",
    "name": "2. La Primavera",
    "date": 1587933289000,
  },
  { "document_key": "N01_3_Quest",
    "name": "3. The great Quest",
    "date": 1587933289000,
    "level": "Elemental",
    "image": "./images/paraEmpezar/N1_3_Quest.jpg",
    "artist": "",
    "sheetMusic": "",
    "subtitle": "Nivel 1",
    "preloadLink": "",
  }
]

No I tried to host the json file in AWS and paste the link in the data plugin setup but it tells me that there is an error loading data from the API. The link is:

https://conservatorio.s3.eu-west-2.amazonaws.com/pianoLessons/paraEmpezarSample.json

What am I doing wrong?