Deserialize zone offset with or without colon
See original GitHub issueIs there a way to configure the module to accept zone offset expressed with and without colon ?
In other words we’d like the parser to read the following two forms:
1970-01-01T01:00:00.000+01:00
1970-01-01T01:00:00.000+0100
Note: it already accepts these two forms but ONLY if offset is zero (+00:00
or +0000
)…
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Java 8 Date and Time: parse ISO 8601 string without colon in ...
@JonSkeet - ISO 8601 allows offsets without a colon in the basic format, and offsets with a colon in the extended format. However,...
Read more >StdDateFormat (jackson-databind 2.11.0 API) - FasterXML
Accessor for checking whether this instance would include colon within timezone serialization or not: if {code true}, timezone offset is serialized like -06:00 ......
Read more >Stand-Alone JSON Serialization using ... - Microsoft Learn
NET objects into JSON data and to deserialize such data back into instances ... If there is no namespace the colon can be...
Read more >DateTimeFormatter (Java SE 12 & JDK 12 ) - Oracle Help Center
Offset Z: This formats the offset based on the number of pattern letters. One, two or three letters outputs the hour and minute,...
Read more >SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
Instead write just 1 without a zero and use at least one digit after a decimal point: JSON.parse('{"foo": 1}'); JSON.parse('{"foo": 1.0}');
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi. I hope it won’t be off-topic question… I have some issue trying to disable ADJUST_DATES_TO_CONTEXT_TIME_ZONE feature in Spring application.
Here is how I tried to configure mapper:
I also tried adding extra properties in application.yml:
But every time deserialization has to kick in, I see under debugger that features is still not disabled (com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer):
_adjustToContextTZOverride is null & context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE) is true and it’s not what I would expect.
How to simply disable ADJUST_DATES_TO_CONTEXT_TIME_ZONE? Deserialization partially works, but result has always “Z” offset instead of precise information (lets have a “2021-04-28T19:58:40+02:00” as example input).
For
OffsetDateTime
andZonedDateTime
…Regarding JDK-provided parsing stuff, I could not find a (easy) way to build a parser that would accept both formats. Something a bit more tolerant like Jackson’s
StdDateFormat
forjava.util.Date
…Before digging deeper I thought it was better to ask here in case I missed something obvious 😉