question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to JSON Serialize Result

See original GitHub issue

General information

  • SDK/Library version: 3.46.0
  • Language, language version, and OS: Python 2.7.0 | MacOS

Issue description

Hello, I’m having trouble JSON serializing the result object that is returned when calling gateway.subscription.create. I’ve tried using json.dumps and it just tells me the object cannot be serialized. I’m sure this is something I’m doing wrong, but I don’t really know where else to go.

Thank you.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
aryaniyapscommented, Apr 29, 2021

@crookedneighbor what about now guys? At the top of my head, I think that we must make the classes inherit from a dict (this would be sort of a breaking change)

class ErrorResults(dict):
    def __init__(self, fname):
        dict.__init__(self, fname=fname)

# directly dump the object
errs = ErrorResults()
json.dumps(errs)

maybe I can make a PR

0reactions
pbnsilvacommented, Apr 5, 2022

Any updates on this? error handling is a bit of a mess in the python api

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to serialize JSON object from file - Stack Overflow
I am unable to deserialize JSON objects from file for some reason, even tho it works from a variable created within the code...
Read more >
[Solved] I can't serialize json - CodeProject
Solution 1. The value you're trying to deserialize doesn't match the JSON you've shown.
Read more >
Unable to serialize to JSON - Home Assistant Community
I have recently (after upgrade to 0.108) had a problem that the logfile grows extremely quickly. The following message is written to logfile...
Read more >
Using EfficientNetB0 and save model will result `Unable to ...
Hello, I'm trying to use EfficientNetB0 to create a model and save the model to my local disk. However, when saving it, it...
Read more >
TypeError: Object of type int64 is not JSON serializable
The Python TypeError: Object of type int64 is not JSON serializable occurs when we try to convert a numpy int64 object to a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found