Closed NigelGee closed 1 year ago
When dateOfBirth has a empty string ("") JSONDecoder can NOT decode into to Date type.
Sorry missed the NOT from previous comment.
I am not really sure it is right to change all empty values for a specific string field to null. In that case, we would have to do the same for all other fields. Also, perhaps we would cause issues to other people who don't use the JSONDecoder.
@NigelGee are you sure you cannot find a workaround?
I not sure about other decoder that people use but I would have a guess that this field would be come an optional string (as you have done with the number fields). Because this is really a date not a string. The work around is to display it in British format only EG (01-02-1999) is 1st Feb 1999 however in USA the would read as 2nd Jan 1999. The JSONDecoder can handle do the right format however if a one of the entries has "" and not "dd-MM-yyyy" it can not decode the json file. I have spent a good few hours try different things to get it into a Date not a string. So while it string field it not the same as the rest of the string fields so unique in the sense. I hope that is clear.
When dateOfBirth has a empty string ("") JSONDecoder can decode into to Date type