tracker issue : CF-3043779

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

Bug 86865:Round trip JSON serialization of queries (serialize to JSON then deserialize back to CF) has a data transparency problem in that null values in the db end up as the string 'null' at the end of the pro

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/

Reporter/Name(from Bugbase): Dave Merrill / Dave Merrill (Dave Merrill)

Created: 04/25/2011

Components: AJAX, Plumbing

Versions: 9.0.1

Failure Type: Unspecified

Found In Build/Fixed In Build: 9,0,1,274733 /

Priority/Frequency: Trivial / Unknown

Locale/System: English / Platforms All

Vote Count: 0

Duplicate ID:	CF-3043777

Problem:

Round trip JSON serialization of queries (serialize to JSON then deserialize back to CF) has a data transparency problem in that null values in the db end up as the string 'null' at the end of the process. The code below illustrates the problem in a portable way; the same issue occurs with NULL values in a real database. Database NULLs have always been returned to CF as empty string, and empty string passes through serialization unchanged. Round trip serialization/deserialization works fine using WDDX, in that both empty string and NULL db values are treated as empty string before and after serialization. However, using JSON, db NULLs  end up deserializing as the actual string 'null', corrupting them. Under no circumstances should NULL values become the word 'null'.
Method:

<cfscript>q = QueryNew('Name');QueryAddRow(q);q.Name[1] = 'foo';QueryAddRow(q);q.Name[2] = '';QueryAddRow(q);</cfscript><cfdump var="#q#" label="original query"><cfset serializedData = SerializeJSON(q)><cfdump var="#serializedData#" label="serialized query"><cfset q = DeserializeJSON(serializedData, false)><cfdump var="#q#" label="after serialization round trip">
Result:

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3043779

External Customer Info:
External Company:  
External Customer Name: Dave Merrill
External Customer Email: 01061405446C42C7992016E5
External Test Config: 04/25/2011

Attachments:

Comments: