Link to home
Start Free TrialLog in
Avatar of AntonioRodrigo
AntonioRodrigo

asked on

DataTable in Json format

Hello,

I am using Visual Studio 2010, Visual C#, .NET framework 4.0.

I have app in IIS. All my methods looks something like this:


        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        public string Select()
        {            
            return "Hello World";
        }

And the work fine - the only problem is how to return DataTable in Json format?

I've found this topic: http://schotime.net/blog/index.php/2008/07/27/dataset-datatable-to-json/

But, nothings comes back from the server. The dictionary<string, object> is created, but nothing is returned from server.

I need to return DataTable in Json format and the (on the client) convert this back to DataTable and show in DataGrid (Windows forms).


Regards, Frenky
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AntonioRodrigo
AntonioRodrigo

ASKER

Yes, very good point. And that list of object I can map to DataTable on the client. I've also found one solution by myself: put DataTable into MemoryStream and return MemoryStream.