我应该使用序列化的DataTable到JSON在ASP.NET 2.0中? [英] What should I use to serialize a DataTable to JSON in ASP.NET 2.0?

查看:98
本文介绍了我应该使用序列化的DataTable到JSON在ASP.NET 2.0中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想支持遗留应用程序我在一年前提出,并需要使用jQuery AJAX调用从服务器获取数据。我有我使用序列化JsonHelper类数据表的DataSet 秒。这通常工作正常,在.NET 4.0中,但.NET 2.0没有 System.Web.Script.Serialization 库,因此没有的JavaScriptSerializer 类。

I'm trying to support a legacy app I made a year ago and need to use jQuery AJAX calls to get data from the server. I have a JsonHelper class that I use to serialize DataTables and DataSets. This normally works fine in .NET 4.0, but .NET 2.0 there is no System.Web.Script.Serialization library and therefore no JavaScriptSerializer class.

我试图找到另一个JSON序列,但到目前为止,我不能得到任何工作。

I've tried to find another JSON serializer, but so far I can't get anything to work.

我使用JSON.NET 2.0试过 HTTP ://json.codeplex.com/releases/view/13099 但它表示,它需要更高的框架。所以,我想JSON.NET 1.3.1 http://json.codeplex.com/releases/view/ 6987
我只能想出如何写JSON到一个txt文件,我想刚好能传递字符串返回给客户端。

I tried using JSON.NET 2.0 http://json.codeplex.com/releases/view/13099 but it said it needed a higher framework. So I tried JSON.NET 1.3.1 http://json.codeplex.com/releases/view/6987 I could only figure out how to write JSON to a .txt file, and I'd like to just be able to pass the string back to the client.

我也只是尝试JsonFx.NET http://jsonfx.net/download/ 序列化库(2.0)。仍无法得到任何工作。

I also just tried JsonFx.NET http://jsonfx.net/download/ serialization library (for 2.0). Still couldn't get anything to work.

我不知道如果我错过了这些库的一些关键因素,如果有一个简单的解决方案。

I don't know if I'm missing some crucial element of these libraries or if there is an easy solution.

在此先感谢

推荐答案

我用这个问题的第一个答案解决我的问题:的DataTable到JSON

I used this question's first answer to solve my problem: DataTable to JSON

我下载了AJAX扩展1.0库和包括System.Web.Extensions.dll与我的项目。 http://www.microsoft.com/download/en/details.aspx?id=883

I downloaded the AJAX Extensions 1.0 Library and included "System.Web.Extensions.dll" with my project. http://www.microsoft.com/download/en/details.aspx?id=883

的JavaScriptSerializer 现在的作品。

这篇关于我应该使用序列化的DataTable到JSON在ASP.NET 2.0中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆