Python JSON loads error: ValueError: Extra data

I have a list of dictionaries that I dump and output to file:

output = call_the_articles() #Function Outputs a List of Dicts
outfile = open("commentData.json", "w") #Also tried 'with open() as outfile:' form
data = dumps(output)
But I can't use json.loads() to read the file, so either I'm encoding or decoding improperly(?) Example:
file = open("commentData.json", "r")
json_data = json.loads(


ValueError: Extra data: line 1 column 28779 - line 1 column 69744 (char 28779 - 69744)

How should I store the list of dicts to file such that they can be decoded into JSON?


As stated in the json python doc

If the contents of fp are encoded with an ASCII based encoding other than UTF-8 (e.g. latin-1), then an appropriate encoding name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed, and should be wrapped with codecs.getreader(encoding)(fp), or simply decoded to a unicode object and passed to loads().

Try to specify in the argument list for load the same encoding used in CommendData.json.

Need Your Help

Preventing an exe file to stop


I was messing around with the startup from GTAIV and trying to force it to run in high priority mode without alt-tabbing.

Checkbox Label Image:hover?

html css css3

I need a glowing background to the images that are displayed when you :hover the image. But I'm not sure whether you can or my selector is incorrect..?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.