Note that there are some explanatory texts on larger screens.

plurals
  1. POColdfusion SerializeJSON creating blank values
    text
    copied!<p>I'm trying to use SerializeJSON() to turn an instance of CFC into a string, whcih I can store in a database and then pull back out again later on.</p> <p>The problem I'm having is using the following code:</p> <pre><code>&lt;cfdump var="#THIS#"&gt; &lt;!--- Convert CFC to JSON ---&gt; &lt;cfset thisJSON = SerializeJSON(THIS)&gt; &lt;cfdump var="#DeserializeJSON(thisJSON)#"&gt; </code></pre> <p>Gives me the following:</p> <p><img src="https://i.stack.imgur.com/6NEIj.png" alt="CFDump of THIS and after Serialize/DeSerialize process"></p> <p>The red dump shows the CFC, with an array called <code>controls</code> with 7 items in it, each is another simpler CFC. When I run <code>serializeJSON</code> and then dump the result of that after passing it back through <code>deserializeJSON</code>, items 3 - 7 have become empty strings.</p> <p>Here's the JSON:</p> <pre><code>{ "MESSAGE":"", "CONTROLS": [ { "INDEX":"1.0", "NAME":"maxP11D", "SELWHERE":"", "DEF":"7940.0", "MMD":true, "ORDER":"7", "APP":"", "PRE":"", "MAXCAP":"35946.0", "FORMAT":"pound", "VALUE":"", "DESC":"List price exc FRF &amp; VED", "MINCAP":"7939.0", "MINVAL":"7939.0", "MAXVAL":"35946.0", "TYPE":"range", "TITLE":"P11D" }, { "INDEX":"2.0", "NAME":"Y13Taxat22", "SELWHERE":"", "DEF":"0.0", "MMD":true, "ORDER":"6", "APP":" pa", "PRE":"Tax at 20%", "MAXCAP":"1904.1099853515625", "FORMAT":"pound", "DESC":"Personal tax rate", "VALUE":"", "MINVAL":"0", "MINCAP":"0.0", "MAXVAL":"1904.1099853515625", "TYPE":"range", "TITLE":"Company car tax" }, "", "", "", "", "" ], "SELECTRESTRICT":" (taxtype&lt;6)AND (t.Make=@Peugeot@)\r\nAND t.model NOT LIKE @%407%@\r\nAND t.model NOT LIKE @% old@\r\nAND t.model != @107 3 door@\r\nAND t.model != @107 5 door@\r\nORDER BY \r\nt.model = @%iOn%@ DESC,\r\nt.model = @107 3 door New@ DESC,\r\nt.model = @107 5 door New@ DESC,\r\nt.model LIKE @%207%@ DESC,\r\nt.model LIKE @%RCZ%@ DESC,\r\nt.model LIKE @%308%@ DESC,\r\nt.model LIKE @%3008%@ DESC,\r\nt.model LIKE @%4007%@ DESC,\r\nt.model = @508 Saloon@ DESC,\r\nt.model = @508 SW@ DESC,\r\nt.model = @508 RXH@ DESC,\r\nt.model LIKE @%5008%@ DESC,\r\nt.model LIKE @%807%@ DESC,\r\nt.model LIKE @%Bipper%@ DESC,\r\nt.model LIKE @%Partner%@ DESC,\r\nt.model ASC ", "SHOWNOTES":true, "MYSQL": { "WHERE":"", "COLS":" t.maxP11D, t.Y13Taxat22, t.Y13Taxat40, t.CO2gpkm, t.fuelConsumptionDf, t.bodyStyle, t.fuelType, ", "EXCLUDE":"" } } </code></pre> <p>Why would the first 2 items convert successfully but the remaining 5 change into strings?</p> <p>I'm positive this code used to work, I have very recently upgraded to CF 9.0.1, has anyone else had a problem with JSON in 9.0.1?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload