any.toJson()
Converts CFML data into a JSON (JavaScript Object Notation) representation of the data.
any.toJson( queryFormat=any, useSecureJSONPrefixOrCharset=any, compact=boolean )
Returns: String
Examples
st = structNew();
st.id = 1;
st.Name = "Water";
st.DESIGNATION = "Important source for all";
st.data = [1,2,3,4,5];
writeDump( st );
<span class="nv">jsonFormat</span> <span class="o">=</span> <span class="nf">st.toJson</span><span class="p">();</span>
<span class="nf">writeDump</span><span class="p">(</span> <span class="nv">jsonFormat</span> <span class="p">);</span>