0

I am looking for a way to convert a JSONL file to JSON.

I have written a python program but at some point it's just getting to slow because the JSON file gets to big. And with every loop I checked if the keys are in there…

Maybe some of you has an idea on how to write a program that does the following: The JSONL file is from a Firebase export, which looks like this: {"__path__":"cars/89dHLbXAOooudSNHv6Jt","__exportPath__":"","__id__":"89dHLbXAOooudSNHv6Jt","brandId":"Fp5Kwr7NXNRPxY7Yx3QK","name":"Testuser", "email": "test.user@email.com", "settings":{"test1":true,"test2":true}}

The document can also have subcollections: {"__path__":"cars/89dHLbXAOooudSNHv6Jt/subcollection/dwadwadawdwaddwa","__exportPath__":"","__id__":"dwadwadawdwaddwa","modelId":"d54321242","name":"testcar", "motor": "example f1"

this needs to be converted into this:

    {
        "cars": {
            "89dHLbXAOooudSNHv6Jt": {
                "brandId": "Fp5Kwr7NXNRPxY7Yx3QK",
                "name": "Testcar",
                "email": "test.user@email.com",
                "settings": {
                    "test1": true,
                    "test2": true
                },
                "subcollection": {
                    "dwadwadawdwaddwa": {
                        "modelId": "d54321242",
                        "name": "testcar",
                        "motor": "example f1"
                    }
                }
            }
        }
    }
  • What is your question? What have you tried that fails? You mention a performance problem, can you be more specific and perhaps extract a [mcve] to illustrate what you're talking about? Please also read [ask] and take the [tour]. – Ulrich Eckhardt Sep 18 '22 at 21:28

0 Answers0