PDA

View Full Version : [CLOSED] JSON Decode Exception



softmachine2011
Jul 25, 2012, 7:25 AM
According to the changelog now I use FormPanelResult in my MVC application

119. The Server AjaxFormResult has been renamed to FormPanelResult.

In v1.x of Ext.NET in one of my request I received this json in result.responseText property:


{success:true,extraParams:{"reboseValue":"0000,00","reboseMask":"9999,99","reboseRegex":"^\\d{0,4}\\,\\d{0,2}$","reboseRegexText":"hhhh,mm","redondeoValue":"000,00","redondeoMask":"?999,99","redondeoRegex":"^[\\ \\+\\-]{0,1}\\d{0,3}\\,\\d{0,2}$","redondeoRegexText":"hhh,mm"}}

But now in v2.x I receive this one:


{success:true,extraParams:{"reboseValue":0000,00,"reboseMask":9999,99,"reboseRegex":"^\\d{0,4}\\,\\d{0,2}$","reboseRegexText":"hhhh,mm","redondeoValue":000,00,"redondeoMask":"?999,99","redondeoRegex":"^[\\ \\+\\-]{0,1}\\d{0,3}\\,\\d{0,2}$","redondeoRegexText":"hhh,mm"}}

And when I try to decode it it throws me an exception.


Ext.decode(result.responseText)

It seems that when I add strings with COMMA it hasn't been quoted as expected in Ext.decode

Daniil
Jul 25, 2012, 10:03 AM
Hi,

I think The problem lays here

"reboseValue":0000,00,"reboseMask":9999,99,

The "0000,00" and "9999,99" are not wrapped in double quotes.

Please try to explicitly set up

ParameterMode.Value
for these Parameters.

softmachine2011
Jul 25, 2012, 2:23 PM
Hi again,

Yes with ParameterMode.Value works and Ext.decode decode json right.

It would be a bug fixed in v2.1 or this is the new behaviour?

Daniil
Jul 25, 2012, 5:45 PM
Now there is auto detection of parameter type. And it doesn't work well in that case.

Generally, it would be best to always set up Mode explicitly.

Though we will look how to fix that issue.

softmachine2011
Jul 26, 2012, 7:07 AM
Ok thanks, right now I would write ParameterMode

Thanks

Daniil
Sep 28, 2012, 2:58 PM
Now there is auto detection of parameter type. And it doesn't work well in that case.

Generally, it would be best to always set up Mode explicitly.

Though we will look how to fix that issue.

It has been fixed in SVN. Thank you for pointing the problem out.