Sorry for the ugly format. I can send the file to you directly if you'd
like.

On Tue, Apr 26, 2011 at 9:28 AM, Patrick Santora <patwe...@gmail.com> wrote:

> I ran into this problem myself and ended up building my own cfc to help
> handle this. It's a mix of other fixes that I've found. Maybe it will help
> you.
>
> <cfcomponent displayname="JSON" output="No">
>
>  <cffunction name="decode" access="public" returntype="any" output="no">
>
>  <cfargument name="data" type="any">
>
>  <cfreturn DeserializeJson(arguments.data)>
>
> </cffunction>
>
>  <cffunction name="encode" access="public" returntype="any" output="no">
>
>  <cfargument name="data" type="any">
>
>   <cfset var key = "" />
>
>  <cfset var json = "" />
>
>  <cfset var keysWithLeadingZeros = "" />
>
>   <!--- serialize json --->
>
>  <cfset json = SerializeJson(arguments.data) />
>
>   <!--- need to search for values that are numeric and have leading zeros
> --->
>
>  <cfif isStruct( arguments.data )>
>
>    <cfloop collection="#data#" item="key">
>
>   <cfif isDefined( "arguments.data.#key#" ) AND IsNumeric( data[ key ] )>
>
>   <cfset json = forceJSONStrings( json, key, data[ key ]) />
>
>   </cfif>
>
>  </cfloop>
>
>  </cfif>
>
>   <cfreturn json>
>
> </cffunction>
>
>  <cffunction name="forceJSONStrings" output="false" access="private"
> returntype="string" hint="Forces JSON to output string values">
>
>  <cfargument name="serializedJSON" type="string" required="true"/>
>
>     <cfargument name="propName" type="string" required="true" />
>
>     <cfargument name="propVal" type="string" required="true" />
>
>     <cfscript>
>
>          var ret = "";
>
>          var key = Trim(arguments.propName);
>
>          var value = Trim(arguments.propVal);
>
>          ret = ReReplaceNoCase(Trim(arguments.serializedJSON),
> '"#key#":[0-9A-Za-z]*\.[0-9A-Za-z]*','"#key#":"#value#"',"ALL");
>
>     </cfscript>
>
>     <cfreturn ret />
>
> </cffunction>
>
>  </cfcomponent>
>
> On Tue, Apr 26, 2011 at 9:24 AM, Russ Michaels <r...@michaels.me.uk>wrote:
>
>>
>> http://kb2.adobe.com/cps/862/cpsid_86263.html
>>
>> There are a couple of JSON related bugs here. Do you have this update
>> installed ?
>>
>>
>>
>> --
>>
>> Russ Michaels
>>
>> www.bluethunderinternet.com  : Business hosting services & solutions
>> www.cfmldeveloper.com        : ColdFusion developer community
>> www.michaels.me.uk           : my blog
>> www.cfsearch.com             : ColdFusion search engine
>> **
>> *skype me*                     : russmichaels
>>
>>
>> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343997
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to