spring-framework / org.springframework.web.servlet.view.json / MappingJackson2JsonView / setPrefixJson

setPrefixJson

open fun setPrefixJson(prefixJson: Boolean): Unit

Indicates whether the JSON output by this view should be prefixed with ")]}', ". Default is false.

Prefixing the JSON string in this manner is used to help prevent JSON Hijacking. The prefix renders the string syntactically invalid as a script so that it cannot be hijacked. This prefix should be stripped before parsing the string as JSON.

See Also
#setJsonPrefix