Should Strings returned from a Controller be wrapped in quotes when the Content-Type is application/json? #6615
Unanswered
mjohnston-il
asked this question in
General
Replies: 1 comment 2 replies
-
The reason for the special behavior for |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When I define a controller endpoint that returns a String object (or HttpResponse) and the @produces("application/json") annotation is present (or omitted completely - it's the default), the response that is written to the client is not a valid JSON response because the String isn't (necessarily) a quoted String. Is this something that Micronaut should handle automatically? A non-String object is automatically serialized to a JSON string, why wouldn't we wrap a String response with quotes to make it a valid JSON string?
Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions