DEV Community

Omar Rharbi
Omar Rharbi

Posted on

Spring Boot rejects large file upload / content in REST endpoint

// Source - https://stackoverflow.com/q/79825415
// Posted by omar rharbu
// Retrieved 2025-11-20, License - CC BY-SA 4.0

HttpMessageNotReadableException: JSON parse error:
String value length (20048537) exceeds the maximum allowed
(20000000, from StreamReadConstraints.getMaxStringLength())

Enter fullscreen mode Exit fullscreen mode

It looks like Jackson is blocking the request because the JSON string is too large. I'm not trying to catch this exception — I just want to understand:

Why this limit exists

Whether I'm uploading the file in the wrong way

What the correct approach is for handling large file uploads in Spring Boot

Has anyone dealt with the StreamReadConstraints max string length issue? What is the recommended way to upload large files without hitting this JSON size restriction?

Thanks!

Top comments (0)