Skip to content
Advertisement

JsonObject returns {“empty”:false} in API response

I have the following code on my project:

JavaScript

When I Log htmlcda parameter, I get the html string correctly. However, in response results JsonObject I get {“empty”:false}. Any help please?

Advertisement

Answer

Spring boot uses jackson as default serializer and you’re trying to return JSONObject itself. Jackson does not know how to serialize it. If you need to return JSON, you can put your properties in Map, and return it. Otherwise, you can return results.toString(), or ResponseEntity.status(HttpStatus.OK).body(result.toString())

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement