-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support @JsonFormat(shape=STRING)
for serialization of Range<T>
#118
Comments
Sounds like a good idea for someone with time & interest to work on, and solid improvement to usability. Tagged as such. |
Assign it to me please, |
@saydar31 I let you decide. But does Guava's |
@saydar31 great to hear you're picking this up! Would prefer to stay consistent with the |
@chris-dekker now that you mention it, this needs to go on the doc. I will add notes to the PR that whatever symbol Jackson returns, the returned unicode of symbol would also be documented. |
@JsonFormat(shape=STRING)
for serialization of Range<T>
Merged for inclusion in 2.17.0 |
I find the standard serialization JSON, while flexible, of
Range<T>
to be quite verbose:When manually processing the results, I prefer to shorter notation produced by, among others, the default
toString()
invocation:[12..34)
.Similar to
Instant
, where we can use@JsonFormat(shape = ..)
to control (de)serialization to use the ISO format or unix milis, it would be great if we could control the shape of the range this way. Keep the default as-is and only when@JsonFormat(shape = STRING)
is provided, use the shorter notation.Granted, this will only work for endpoints having scalar values, but that seems to cover the majority of use cases I've seen so far.
The text was updated successfully, but these errors were encountered: