you are viewing a single comment's thread
view the rest of the comments
[–] 1 point 6 hours ago (1 child)

I think json.dumps would not work if there is a datetime in the dict, right?

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 55 minutes ago (1 child)

    Yeah there's other edge cases too, like Decimal, but as long as you have those things imported when you send it through dumps it should work.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 42 minutes ago

    Just tried it in an ipython shell

    import datetime
    import json
    
    json.dumps({"a": datetime.datetime(1970,1,1)})
    

    And I got the TypeError: datetime not JSON serializable though.

  • source
  • parent