March 2018 Archives

Numbers and Strings in JSON

We needed to upgrade from EL6 to EL7 at work. After the upgrade, we noticed some of the JSONs returned from the APIs had changed: some numbers were suddenly enclosed in double quotes, while some others lost the quotes, which broke customers’ code written in strongly typed languages (e.g. Java).

We used the system default perl to drive our web application, using libraries provided by the vendor. While Perl’s version changed from 5.10.1 to 5.16.3, the version of JSON::XS responsible for creation of JSON data jumped from 2.27 to 3.01. Both the changes contributed to the problem.

About E. Choroba

user-pic I blog about Perl.