19.12 JSON Mapping View

TheMappingJackson2JsonViewuses the Jackson library’sObjectMapperto render the response content as JSON. By default, the entire contents of the model map (with the exception of framework-specific classes) will be encoded as JSON. For cases where the contents of the map need to be filtered, users may specify a specific set of model attributes to encode via theRenderedAttributesproperty. TheextractValueFromSingleKeyModelproperty may also be used to have the value in single-key models extracted and serialized directly rather than as a map of model attributes.

JSON mapping can be customized as needed through the use of Jackson’s provided annotations. When further control is needed, a customObjectMappercan be injected through theObjectMapperproperty for cases where custom JSON serializers/deserializers need to be provided for specific types.

JSONPis supported and automatically enabled when the request has a query parameter namedjsonporcallback. The JSONP query parameter name(s) could be customized through thejsonpParameterNamesproperty.

results matching ""

    No results matching ""