You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow use of @JsonFormat(shape=Shape.STRING) for string[], int[], long[] #1242
and it would seem reasonable to allow use of Shape.STRING for this.
A related question is that of how to indicate pattern to use; simplest starting point is probably to allow use of pattern to refer to separator to use; and consider "" to either detault to something like [\s*,\s*], or lead to exception for missing pattern.
My thought is that when the default pattern value is "", we could treat it as \s*,\s* by default,
and only fail when an explicit option such as FAIL_ON_* is enabled.
This is because using [\s*,\s*] results in values like [localhost:8080, , otherhost.com:8080],
whereas using \s*,\s* produces [localhost:8080, otherhost.com:8080].
And there is the big question of how (or, if) to support reading and writing: for most @JsonFormat cases either only writing (serialization) is supported, or both. Here I wrote issue implying maybe only reading was supported... but I think both should be supported. That does get trickier however; and @JsonFormat has no mechanism to indicate separate patterns for reading/writing.
So, I am not sure how practical this idea really is.
More generally the idea is just that it'd be nice to have "primitive/String arrays to/from JSON String", my suggested pattern (of separator definition) was just very basic thinking-out-loud example.
Activity
JacksonJang commentedon Jan 12, 2026
Is this plan still valid?
My thought is that when the default pattern value is
"", we could treat it as\s*,\s*by default,and only fail when an explicit option such as
FAIL_ON_*is enabled.This is because using
[\s*,\s*]results in values like[localhost:8080, , otherhost.com:8080],whereas using
\s*,\s*produces[localhost:8080, otherhost.com:8080].What do you think about this approach?
cowtowncoder commentedon Jan 12, 2026
This is more a general idea than plan, FWTW.
And there is the big question of how (or, if) to support reading and writing: for most
@JsonFormatcases either only writing (serialization) is supported, or both. Here I wrote issue implying maybe only reading was supported... but I think both should be supported. That does get trickier however; and@JsonFormathas no mechanism to indicate separate patterns for reading/writing.So, I am not sure how practical this idea really is.
More generally the idea is just that it'd be nice to have "primitive/String arrays to/from JSON String", my suggested pattern (of separator definition) was just very basic thinking-out-loud example.