I have a JSON file (api.json) with list of dictionaries from API like that:
[
{
"column1": "value1",
"column2": "value2",
"column3": "value3"
},
{
"column1": "value4",
"column2": "value5",
"column3": "{'something':'something'}"
},
{
"column1": "value7",
"column2": "value8",
"column3": "value9"
},
]
Every dictionary in the list represents one row in database. The list is large in size and I don't want to load it to memory. How do I split the file into multiple smaller files(without going to bash) - each containing a list of no more than 1000 dictionaries? According to https://stackoverflow.com/a/6475340/8156638 I can read the file line by line but how do split it?
PS When I try to use json.load() I get MemoryError