cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Not happy with your Spotify Wrapped? Check out how Kevin on the Dropbox team used Paper to make sure he keeps discovering new music over here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
1
Ask
2
Comments

Cast dropbox class to JSON

Cast dropbox class to JSON

rgahan
Explorer | Level 4

I am using the Python Dropbox package to pull team events:

```
dbx = dropbox.DropboxTeam(self.access_token)
result = dbx.team_log_get_events()
```

I need to pass the value of `result` along as a JSON object. When I try using `json.dumps(result)`, I get this error:
> TypeError: Object of type GetTeamEventsResult is not JSON serializable

Is there a way to cast to json/dict with the Dropbox package?

My other potential solutions would be to write my own method to cast it (seems tedious) or just make API calls instead of using the package.

1 Accepted Solution

Accepted Solutions

Re: Cast dropbox class to JSON

Greg-DB
Dropboxer

[Cross-linking for reference: https://stackoverflow.com/questions/70041701/cast-dropbox-class-to-json ]

 

The methods for calling the API in the Dropbox Python SDK don't return JSON-serializable objects (or the original JSON from the server), but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.

 

You can transform the information in the returned native object however you wish, but you'd need to write the code to do so though unfortunately, as you mentioned.

View solution in original post

1 Reply 1

Re: Cast dropbox class to JSON

Greg-DB
Dropboxer

[Cross-linking for reference: https://stackoverflow.com/questions/70041701/cast-dropbox-class-to-json ]

 

The methods for calling the API in the Dropbox Python SDK don't return JSON-serializable objects (or the original JSON from the server), but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.

 

You can transform the information in the returned native object however you wish, but you'd need to write the code to do so though unfortunately, as you mentioned.

Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?