Sep 19, 2008, 7:55 AM
[CLOSED] JSON conversion
Hi!
I have a gridpanel where I can add, delete and modify the records and then I have a button with an userParam where I get the changedData of the store.
Now I need a JSON object to easily navigate the JSON string passed from the .getChangedData() function.
I found the JSON.deserialize() function but it seems not work because it thrown a null reference exception.
Here the code:
ASPX
but a NullReferenceException was thrown by the function deserialize:
Thanks!
Ale
I have a gridpanel where I can add, delete and modify the records and then I have a button with an userParam where I get the changedData of the store.
Now I need a JSON object to easily navigate the JSON string passed from the .getChangedData() function.
I found the JSON.deserialize() function but it seems not work because it thrown a null reference exception.
Here the code:
ASPX
<ext:Button ID="btnSavePro" runat="server" Text="Salva Profilo" AutoPostBack="false" Icon="disk">
<AjaxEvents>
<Click OnEvent="Salva_Profilo">
<UserParams><ext:Parameter Name="ChangedData" Value="#{stProfili}.getChangedData()" Mode="Raw" /></UserParams>
</Click>
</AjaxEvents>
</ext:Button>
Code Behind Dim strJSON As String = e.UserParams("ChangedData")
Dim jr As JsonReader = JSON.Deserialize(strJSON)
The strJSON object contains a string like this: ""Deleted":[{"ID_PROFILO":8,"NOME_PROFILO":"Carne"}],"Updated":[{"ID_PROFILO":18,"NOME_PROFILO":"panini"}],"Created":[{"ID_PROFILO":"","NOME_PROFILO":"insalata"}]"but a NullReferenceException was thrown by the function deserialize:
public static object Deserialize(string value)
{
return JavaScriptConvert.DeserializeObject(value); 'here the NullReferenceException
}
It's a bug or there's something wrong in my code?Thanks!
Ale
Last edited by geoffrey.mcgill; Oct 01, 2010 at 7:48 PM.
Reason: [CLOSED]