Hi again - another moshi question. I have a java c...
# squarelibraries
w
Hi again - another moshi question. I have a java class with a no arg constructor and the following field
Copy code
private long camera_id = 0;
when the field is absent in the JSON I get a
Copy code
com.squareup.moshi.JsonDataException: Expected a long but was NULL at path $.camera_id
Do I need to make my own type adapter to handle this case? Trying to migrate my teams project from GSON
this seems to suggest a type adapter may be necessary https://github.com/square/moshi/issues/114
a
I haven't used moshi (nor java) in ages but what would happen if you box the value? Try using
Long
also 😶
p
Interesting syntax, what language is that?