You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know that we can fix this, because in (all?) other cases, if a value is a numeric string we should show it as a numeric, e.g. phone: "5551235555" would become "phone": 5551235555... zip codes are a difficult problem because of the leading zeros.
Additionally, international zip ("postal") codes often contain non-numeric data; so personally I tend to think of zip codes as strings 100% of the time.
For that reason, I usually prepend a space or other alpha character to the zip code and then strip it out in the client.
I've been using zip-codes w/JSONUtil. To preserve values as strings, use Javacast("string", value). This will ensure that the value isn't treated generically as numeric and/or converted to scientific notation. When serializing or deserializing, ensure that strictMapping=true. (I used this method when submitting east coast zip codes to a USPS API endpoint.)
Activity
atuttle commentedon Apr 15, 2016
I don't know that we can fix this, because in (all?) other cases, if a value is a numeric string we should show it as a numeric, e.g.
phone: "5551235555"would become"phone": 5551235555... zip codes are a difficult problem because of the leading zeros.Additionally, international zip ("postal") codes often contain non-numeric data; so personally I tend to think of zip codes as strings 100% of the time.
For that reason, I usually prepend a space or other alpha character to the zip code and then strip it out in the client.
JamoCA commentedon Jan 15, 2020
I've been using zip-codes w/JSONUtil. To preserve values as strings, use
Javacast("string", value). This will ensure that the value isn't treated generically as numeric and/or converted to scientific notation. When serializing or deserializing, ensure thatstrictMapping=true. (I used this method when submitting east coast zip codes to a USPS API endpoint.)