JSON Serialization
JSON Serialization
Hi Alan
Thanks for your replies earlier... I got my DataTable working with protoType.js
I do need some suggestion on the Best way for JSON Serialization on ServerSide
I get back a List which I want to convert into JSON(Expected by DataTable)... I used JSONSerializer, but I get key:value delaminated String which is not Recognized by DataTable as Valid .... Can you please tell me any Standard API which can be used...
Thanks Again
Thanks for your replies earlier... I got my DataTable working with protoType.js
I do need some suggestion on the Best way for JSON Serialization on ServerSide
I get back a List which I want to convert into JSON(Expected by DataTable)... I used JSONSerializer, but I get key:value delaminated String which is not Recognized by DataTable as Valid .... Can you please tell me any Standard API which can be used...
Thanks Again
This discussion has been closed.
Replies
Good to hear you got it (mostly) working! I'm presuming that you are using C# or VB.NET or something like that? I'm not that well versed in .NET technologies, but basically all you need to do is have it output a string which matches the format shown here: http://datatables.net/usage/server-side . In my PHP example I've just created and then echoed a string to do this - you could do something like this in your .NET language, if you can't find a suitable serialiser.
Regards,
Allan
I am using Java on the Server Side, and using my own Serializer which can take in the column name and generate JSON which is Only Values, and not the "key : Value" which is done by most of the Serializers like Xstrem available...
Maybe there is a Better way of doing this, so was thinking you can provide any known api which can be used to generate JSON for DataTables...
Also one thing I notices is , Error Console in FireFox keeps on Complaining that the Json is not well-formed.
The DataTable is painitng the Data Correctly on the Screen, but the FireFox Error Console still complains...As Suggested by you, I used the jsonlint(http://www.jsonlint.com/) to validate the generated Json and it shows zero errors... I will post the JSON string in reply soon, Since I dont have it right now...
Thanks
Sobers
Thanks
I am having the same issue
I can generate the Json
[code]
{"sEcho":1,"iTotalRecords":10,"iTotalDisplayRecords":10,"aaData":[[{"Job":"Plumber","Name":"John"}],[{"Job":"Plumber2","Name":"John2"}]]}
[/code]
which is valid Json
but is no accepted by the grid
Did you ever get it resolved?
thanks
Regards,
Allan