I am currently developing a project which uses the Twint python library for web-scraping Twitter. The problem is, the way it saves the scraped data to is invalid in regards to JSON Formatting standards. All of the scraped tweets are saved as objects inside the JSON file, and when I try to parse them I get an error, since they aren't separated with commas and aren't in an array.
{'key1': value1, 'key2': value2,}
{'key1': value1, 'key2': value2,}
{'key1': value1, 'key2': value2,}
as opposed to:
[
{'key1': value1, 'key2': value2,},
{'key1': value1, 'key2': value2,},
{'key1': value1, 'key2': value2,}
]
My question is, can i fix this by writing a script that would wrap the list of objects in an Array and separates the objects with commas?
Replace
}
with},
? Or is that to simple as a solution?