tracker issue : CF-4206423

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

New Metadata Mutation Makes Booleans Incompatibile with Gson library

| View in Tracker

Status/Resolution/Reason: To Fix//BugVerified

Reporter/Name(from Bugbase): Jon C. / ()

Created: 12/18/2019

Components: Core Runtime

Versions: 2018

Failure Type: Data Corruption

Found In Build/Fixed In Build: 2018.0.03.314033 /

Priority/Frequency: Normal / Some users will encounter

Locale/System: English / Linux

Vote Count: 3

Problem Description:
In ACF2018, booleans declared in structs have a metadata mutation that causes the Gson library ( ) to serialize a boolean to JSON as a nested object: {"value":true,"image":"true"}.  This Gson library is frequently used in CF integrations with java libraries.

This problem does not exist in previous versions of Adobe Coldfusion.

Steps to Reproduce:

1. Add the Gson JAR to the class path or application library
2. Put the following code in onRequestStart of Application.cfc:

var document = {
	"foo" : "bar",
	"bar" : {
		"foo" : true

var jLoader = wirebox.getInstance( "loader@cbjavaloader" );
writeDump( createObject( "java", "" ).init().toJson( document ) );["baz"] = {
	"foo" : false

writeDump( createObject( "java", "" ).init().toJson( document ) );


Actual Result:


All declared booleans are serialized as nested objects

Expected Result:

{"bar":{"foo":true },"foo":"bar"} {"bar":{"foo":true,"baz":{"foo":true}},"foo":"bar"}

All booleans should be serialized as booleans

Any Workarounds:

Explicit javacasting of every declared or running the object through deserializeJSON( serializeJSON( document ) ).