On Jan 16, 2:50 pm, "J.Lucido" <[email protected]> wrote:
> First, I am relying on the function isJSON() to validate the POST data
> the client is sending to our gateway. I found that this function will
> always return "true" regardless of the string you pass the function.
> So, "isJSON('fooBar')" returns true. I am not too sure this is what
> should be happening. I would think at the least it should verify that
> the string starts and ends with braces ({}). Any one else experience
> this?

Reported in http://code.google.com/p/openbluedragon/issues/detail?id=169

There's a patch attached to that ticket that should fix it.

> Next, I am also experiencing issues with the deserializeJSON()
> function and I am not too sure if it is either a flaw in the
> function's logic or a flaw in my expectations/logic.

Reported in http://code.google.com/p/openbluedragon/issues/detail?id=192

There's a patch attached to that as well. This was an interesting one--
basically what OpenBD is doing is if a JSON value *can* be converted
to a Double it does so regardless of the data type of the original
JSON value. So I wrapped the portion of the DeserializeJSON() function
that does the number conversion in a check to see if the original
value is an instance of String. If it is, it'll leave it alone and not
do the number conversion. What this means in terms of usage is if you
wrap any JSON values in quotes, they will no longer be converted to a
Double. If you do want numbers to be converted to a Double, don't wrap
the value in quotes. I believe this behavior is consistent with Adobe
CF now.

> Finally, is a related issue in the deserialize function another field
> value is the amount of the transaction. Again, this data is enclosed
> in double quotes (ex. "amount":"10.00") and is treated as a number in
> the conversion process and thus the value becomes "10".

This will be fixed via the same DeserializeJSON() patch.

Note that neither patch is official but fixed the issues in my own
(and Jeff's) testing.
-- 
Open BlueDragon Public Mailing List
 http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
 mailing list - http://groups.google.com/group/openbd?hl=en

 !! save a network - please trim replies before posting !!

Reply via email to