Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Abhay Yadav
6 years agoExplorer | Level 4
Bad JSON: expected object value. exception while uplaoding a file using dropbox Java SDK
Hi all, I am trying to upload a file using dropbox Java SDK (version 3.1.5). I amgetting file from a ajax form and then trying to upload it but getting the below exception when calling uploadAndF...
Greg-DB
Dropbox Community Moderator
6 years agoThanks for following up. That actually sounds like a bug in the SDK then. The SDK should automatically convert the 'invalid_access_token' error response to a proper exception. I'll look into it and ask the team to fix that up.
FilipRachunek
5 years agoExplorer | Level 4
Hello,
I have the same problem, using Dropbox Java SDK 3.1.5. I suspect the issue could be related to new short-lived access tokens and scoped apps, as I don't see this error with "no expiration" token and "full Dropbox" permission type (created in the past).
So, my first idea was that some scoped permissions were missing, as all read operations work fine, and the problem occurs only with "uploadAndFinish(inputStream)" method. However, I checked the permissions and I didn't see anything wrong there - there are checked checkboxes at files.metadata.write, files.metadata.read, files.content.write, files.content.read.
Can you help, please? I am out of ideas.
Filip
- Greg-DB5 years ago
Dropbox Community Moderator
FilipRachunek This is a bug in the Java SDK. This is still open with engineering, but I don't have an update on it yet. I'll follow up here once I do.
- FilipRachunek5 years agoExplorer | Level 4
@Greg-DB Thanks for your prompt response. I'll wait for the SDK update.
Filip
- FilipRachunek5 years agoExplorer | Level 4
Hello,
The error is still there, even in version 4.0.0 of the Java SDK.
com.dropbox.core.BadResponseException: Bad JSON: expected object value. at [Source: (String)""; line: 1, column: 1] at com.dropbox.core.DbxRequestUtil.unexpectedStatus(DbxRequestUtil.java:347) ~[dropbox-core-sdk-4.0.0.jar:na] at com.dropbox.core.DbxRequestUtil.unexpectedStatus(DbxRequestUtil.java:324) ~[dropbox-core-sdk-4.0.0.jar:na] at com.dropbox.core.DbxUploader.finish(DbxUploader.java:268) ~[dropbox-core-sdk-4.0.0.jar:na] at com.dropbox.core.DbxUploader.uploadAndFinish(DbxUploader.java:126) ~[dropbox-core-sdk-4.0.0.jar:na] at com.dropbox.core.DbxUploader.uploadAndFinish(DbxUploader.java:96) ~[dropbox-core-sdk-4.0.0.jar:na] at com.dropbox.core.v2.DbxUploadStyleBuilder.uploadAndFinish(DbxUploadStyleBuilder.java:92) ~[dropbox-core-sdk-4.0.0.jar:na]Any chance to fix it soon? I understand that long-lived access tokens will stop working by the end of September 2021, so we'll have to switch to short-lived. However, it's not possible as long as the SDK throws this exception.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!