kurtmckee/feedparser

Feedparser output isn't in the correct JSON Format. Unable to deserialize into objects

Closed this issue · 4 comments

Feedparsers generates a JSON like formatting, but the problem is that it uses single quotes (') instead of double (") which is needed for JSON standard. For this reason I can't directly deseriale the output of feedparser.

I'm using an atom 1.0 feed, not sure if this is the case with other feeds.

image

feedparser doesn't produce JSON.

It sound like you're printing the dictionary that feedparser returns and assuming that this is JSON output, or writing a representation of the result to a file. In this case, Python uses single quotes in the string representation of the dictionary.

You must import Python's json module (which is built into the standard library) construct a dictionary with the structure you want, then call json.dumps(your_dictionary_here), which will generate a JSON-formatted string that you can either print or write to a file.