A # breaks the feeds.json file #9

Open
opened 4 years ago by mb · 1 comments
mb commented 4 years ago

Hmm, maybe a short replacement search/replace can be done? Or are there other ways in Python to check if a JSON object is "safe"?

Hmm, maybe a short replacement search/replace can be done? Or are there other ways in Python to check if a JSON object is "safe"?
Owner

the python3 json library can already do that with the load and loads function.
https://pynative.com/python-json-validation/

I think the trouble is updating the rss feeds to the simple database using db.update on line 41 of feedtools.py

I don't think that function cares about valid json. So load everything into a valid json object using json.load(tmp) and then update that to the SimpleDatabase

in my opinion this is always a better approach than small fixes by hand, now its a #, next time its a "\/". json.loads does that all for you perfectly.

the python3 json library can already do that with the load and loads function. https://pynative.com/python-json-validation/ I think the trouble is updating the rss feeds to the simple database using db.update on line 41 of feedtools.py I don't think that function cares about valid json. So load everything into a valid json object using json.load(tmp) and then update that to the SimpleDatabase in my opinion this is always a better approach than small fixes by hand, now its a #, next time its a "\\/". json.loads does that all for you perfectly.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.