I have a json file. A simplified version of it looks as following:
{
\"host\": \"a.com\",
\"ip\": \"1.2.2.3\",
\"port\": 8
}
{
\"host\":
As you already found out: that is not valid JSON.
You have to modify it to make it valid, specifically, you have to wrap your top-level objects in an array. Try this:
import json
from pprint import pprint
with open('myfile.json') as f:
data = json.loads("[" +
f.read().replace("}\n{", "},\n{") +
"]")
print(data)