2022-07-21

ajax, upload file, json string, Spring Controller, DTO

 



Googled: json to dto spring boot controller




Resolved by follow the example on: 

Spring Boot controller - Upload Multipart and JSON to DTO




thread solution at: https://stackoverflow.com/a/49993072


Ajax Javascript
formData.append( 'dtoName', new Blob([JSON.stringify(dtoJavascriptObject)], {
type: "application/json"
}));

Spring Controller parameter

@RequestPart ManualGenerateCsv dtoName






No comments:

Post a Comment