CARVIEW |
Select Language
HTTP/2 200
date: Fri, 18 Jul 2025 04:45:51 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"3692513e0037950c2ab4012e86c6b5f2"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=gFmLvieoEaOaY7M5j01oxZUTIk5E%2FPmF57V4OsJdWqs8D8Fu6hWtRkqZ3Csc%2BhM4fpXBNnLzth7FXrFhE6N9UupjgKDhy8AxIoxELngGLcrxeBJc%2FmIGy8O81ARQbQDBYnA9BmElu90plw2C1fWSNDIx36%2BSldNYzesQn7R%2F1hcrHjwDK6SAEscU1SFGW%2Fv1On9yAMxjDk3SRpmc4b58N8ZOtjfaFdVDeYTQoGWU9cyuA%2FVPC%2FzO%2FVaARIEGzWGFXOt%2BwyOj%2ByO4muw%2FcPvVEw%3D%3D--ifuh2Vcd6jGczgzS--l39SPPxDSpO4noao5mUfvQ%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.112975772.1752813951; Path=/; Domain=github.com; Expires=Sat, 18 Jul 2026 04:45:51 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Sat, 18 Jul 2026 04:45:51 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: C64E:3BD3F1:74E4E5:93BE53:6879D17F
JsonWriteFeatures · FasterXML/jackson-core Wiki · GitHub
Skip to content
Navigation Menu
{{ message }}
-
-
Notifications
You must be signed in to change notification settings - Fork 815
JsonWriteFeatures
Tatu Saloranta edited this page Jun 10, 2025
·
7 revisions
This set of features was added in Jackson 2.10, split off from earlier JsonParser.Feature. It contains features that are only relevant and usable on JSON backend.
Note: with 2.10 and later 2.x version there is overlap between new and old features: Jackson will keep "same" settings in sync so you can whichever; but recommendation is to use newer set of features to ease migration to 3.0.
These features can be modified when constructing JsonFactory
or JsonMapper
(or ObjectMapper
since JsonMapper
is a subtype of ObjectMapper
), or when creating ObjectWriter
instance as shown below (using WRITE_NUMBERS_AS_STRINGS as an enable example and QUOTE_FIELD_NAMES as a disable example):
// Option 1, modifying when constructing JsonFactory
JsonFactory f = JsonFactory.builder()
.enable(JsonWriteFeature.WRITE_NUMBERS_AS_STRINGS)
.disable(JsonWriteFeature.QUOTE_FIELD_NAMES)
.build();
// Option 2, modifying when constructing JsonMapper or base type ObjectMapper
JsonMapper m = JsonMapper.builder()
.enable(JsonWriteFeature.WRITE_NUMBERS_AS_STRINGS)
.disable(JsonWriteFeature.QUOTE_FIELD_NAMES)
.build();
ObjectMapper m = JsonMapper.builder()
.enable(JsonWriteFeature.WRITE_NUMBERS_AS_STRINGS)
.disable(JsonWriteFeature.QUOTE_FIELD_NAMES)
.build();
// Option 3: defining when creating ObjectWriter instance
ObjectWriter r = mapper.writer()
.with(JsonWriteFeature.WRITE_NUMBERS_AS_STRINGS)
.without(JsonWriteFeature.QUOTE_FIELD_NAMES);
Settings can be divided in couple of loose categories, as follows.
-
COMBINE_UNICODE_SURROGATES_IN_UTF8 (default: false) (added in 2.18)
- Feature that specifies how characters outside "Basic Multilingual Plane" (BMP) -- ones encoded as 4-byte UTF-8 sequences but represented in JVM memory as 2 16-bit "surrogate"
char
s -- should be encoded as UTF-8 byJsonGenerator
- If enabled, surrogate pairs are combined and flushed as a single, 4-byte UTF-8 character.
- If disabled, each
char
of surrogate pair is written as 2 separate characters: that is, as 2 separate 3-byte UTF-8 characters with values in Surrogate character ranges(0xD800
-0xDBFF
and0xDC00
-0xDFFF
)
- Feature that specifies how characters outside "Basic Multilingual Plane" (BMP) -- ones encoded as 4-byte UTF-8 sequences but represented in JVM memory as 2 16-bit "surrogate"
-
ESCAPE_FORWARD_SLASHES (default: false (2.x), true (3.x)) (added in 2.17)
- Feature that specifies whether
JsonGenerator
should escape forward slashes ("/") by default (without other encoding configuration)- If enabled, forward slashes are escaped (as '/')
- If disabled, forward slashes are written as-is (as
/
)
- Feature is disabled by default in Jackson 2.x, but enabled by default in Jackson 3.0.
- Feature that specifies whether
-
ESCAPE_NON_ASCII (default: false)
- Feature that specifies that all characters beyond 7-bit ASCII range (i.e. code points of 128 and above) need to be output using backslash-escape.
- Maps to
JsonGenerator.Feature.ESCAPE_NON_ASCII
-
QUOTE_FIELD_NAMES (default: true)
- Feature that determines whether JSON Object field names are quoted using double-quotes, as specified by JSON specification or not. Ability to disable quoting was added to support use cases where they are not usually expected, which most commonly occurs when used straight from Javascript.
- Maps to
JsonGenerator.Feature.QUOTE_FIELD_NAMES
-
WRITE_HEX_UPPER_CASE (default: true)
- Feature that specifies whether hex values are encoded using upper-case letters (
true
) or lower-case letters (false
) - JSON uses hex-values for character escapes
- Feature that specifies whether hex values are encoded using upper-case letters (
-
WRITE_NAN_AS_STRINGS (default: true)
- Feature that determines whether "NaN" ("not a number", that is, not real number) float/double values are output as JSON strings.
- The values checked are
Double.Nan
,Double.POSITIVE_INFINITY
andDouble.NEGATIVE_INIFINTY
(and associatedFloat
values). - If feature is disabled, these numbers are still output using associated literal values, resulting in non-conforming output.
- Maps to
JsonGenerator.Feature.QUOTE_NON_NUMERIC_NUMBERS
-
WRITE_NUMBERS_AS_STRINGS (default: false)
- Feature that forces all regular number values to be written as JSON Strings, instead of as JSON Numbers (that is, enclosed in double-quotes)
- Maps to
JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS
Clone this wiki locally
You can’t perform that action at this time.