Skip to content
This repository has been archived by the owner on Jan 31, 2025. It is now read-only.

JSON-to-POJO parsing fails on null values #2326

Closed
jbartok opened this issue Jun 12, 2020 · 5 comments
Closed

JSON-to-POJO parsing fails on null values #2326

jbartok opened this issue Jun 12, 2020 · 5 comments
Assignees
Milestone

Comments

@jbartok
Copy link
Contributor

jbartok commented Jun 12, 2020

com.fasterxml.jackson.jr.ob.JSONObjectException: Can not get long numeric value from JSON (to construct java.util.Date) from 'null'

{"id":3,"firstName":"John","lastName":"Roe","birthdate":null,"__op":"c","__db":"app","__table":"Person","__ts_ms":1591958881311,"__deleted":"false"}"; line: 1, column: 57]

	at com.fasterxml.jackson.jr.ob.JSONObjectException.from(JSONObjectException.java)
	at com.fasterxml.jackson.jr.ob.impl.SimpleValueReader._fetchLong(SimpleValueReader.java)
	at com.fasterxml.jackson.jr.ob.impl.SimpleValueReader.read(SimpleValueReader.java)
	at com.fasterxml.jackson.jr.ob.impl.SimpleValueReader.readNext(SimpleValueReader.java)
	at com.fasterxml.jackson.jr.ob.impl.BeanReader.read(BeanReader.java)
	at com.fasterxml.jackson.jr.ob.impl.JSONReader.readBean(JSONReader.java)
	at com.fasterxml.jackson.jr.ob.JSON.beanFrom(JSON.java)
	at com.hazelcast.jet.json.JsonUtil.beanFrom(JsonUtil.java:85)
	...
@gurbuzali
Copy link

gurbuzali commented Jun 12, 2020

looks like jackson-jr does not support reading null date as it always expects a long value.
see comment here FasterXML/jackson-jr#48 (comment)
drawback of using a jr json library. JsonFormat annotation does not work too since jackson-jr supports only a subset of jackson-annotations, which does not include JsonFormat.

@jbartok jbartok self-assigned this Jun 15, 2020
@jbartok
Copy link
Contributor Author

jbartok commented Jun 15, 2020

Problem will be fixed by #2247 via documenting how to work around it (it's unlikely that jackson-jr will fix it, since it's there since 4 years).

@jbartok
Copy link
Contributor Author

jbartok commented Jun 24, 2020

For now the workaround from #2247 should be fine, we are going to get a proper fix from jackson-jr for 4.3.

@jbartok jbartok modified the milestones: 4.2, 4.3 Jun 24, 2020
@jbartok
Copy link
Contributor Author

jbartok commented Jul 7, 2020

I've submitted an issue, let's see what feedback we get: FasterXML/jackson-jr#73

@jbartok
Copy link
Contributor Author

jbartok commented Sep 2, 2020

Has been fixed by #2459.

@jbartok jbartok closed this as completed Sep 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants