tracker issue : CF-4198870

select a category, or use search below
(searches all categories and all time range)
Title:

Invalid JSON generated when string looks like a numeric value

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Bryan Henderson / Bryan Henderson ()

Created: 06/19/2017

Components: AJAX

Versions: 2016,11.0,2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 11,0,12,302575 / 2018,0,0,303797

Priority/Frequency: Normal / Unknown

Locale/System: / Windows 7 64-bit

Vote Count: 0

Problem Description: 
serializeJSON() is generating invalid JSON for strings that look like a number, but end with a period and space (similar to CF-3710273, but still an issue.)  

CF can deserialize the generated value, however; it results in a string like "1. " being deserialized as 1 (without the period.)  

It CANNOT be parsed by browsers: JSON.parse('1. ') results in the following JavaScript error: "SyntaxError: JSON.parse: missing digits after decimal point at line 1 column 3 of the JSON data"

Steps to Reproduce:
<cfdump var="#serializeJSON('1. ')#" />

Actual Result:
1.

Expected Result:
"1. "

Any Workarounds:
trimming the trailing white space results in the correct serialization

Attachments:

Comments: