JSon序列化提供程序 [英] JSon Serialization Provider

查看:73
本文介绍了JSon序列化提供程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,

我正在为将使用Json数据的应用程序构建后端服务.我正在尝试找出一种执行此操作的好方法,并且对实际序列化我的数据有些困惑.我正在使用VS2012,并尝试了WCF和ASP.NET.

I am building a backend service for an application that will consume Json data. I am trying to figure out a good way of doing this and I am a little confused about what is actually serializing my data. I am using VS2012 and have tried WCF and ASP.NET.

我尝试了一项服务,该服务序列化具有自我参考的对象(标头包含指向标头的详细信息参考),该服务默默失败.我以为是默认设置 序列化程序.我向测试对象添加了一些日期,并且基于该格式,我不认为我正在使用Json.NET(Newtonsoft?)序列化-我得到的结果看起来像这样: InsertDate":"\/Date(1363623883567-0600)\/",

I tried a service that serializes an object that has a self-reference (header contains details reference that point back to header), which fails silently. I was thinking that was allowed with Json.NET, which I thought was the default serializer. I added some dates to my test object and based on the format, I don't think I am using Json.NET (Newtonsoft?) serialization -- what I get back looks like this: ,"InsertDate":"\/Date(1363623883567-0600)\/",

我知道我可以覆盖序列化,但是此链接向我暗示我以某种方式不使用最新版本: http://www.asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serialization

I know I can override the serialization but this link implies to me that I am somehow not using the latest: http://www.asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serialization

我也尝试过用Nuget将Json.NET添加到项目中,但是没有任何运气.

I have also tried adding Json.NET to the project with Nuget without any luck.

有人可以向我指出一组有关设置将使用Json.NET的简单Restful Json服务的说明吗?一个有希望的示例是

Can someone point me to a set of instructions on setting up a simple Restful Json service that will use Json.NET? One promising example was RESTful WCF Services with No svc file and No config, but again, it is using the old default serializer.

谢谢

大卫·莫里斯(David Morris)

David Morris

 

David Morris

David Morris

推荐答案

据我所知,Json.Net是第三方,您是说您不是否想为您的休息服务使用默认的DataContractJsonSerializer,但要使用类似的Json.NET MediaTypeFormatter?

Hi, as I know, Json.Net is a third party one, do you mean you do not want to use the default DataContractJsonSerializer for your rest service, but use one like Json.NET MediaTypeFormatter?

据我所知,您可以使用Web API替换或添加任何序列化程序或格式化程序.

As I know, using Web API, you can replace or add any serializer or formatter. 


这篇关于JSon序列化提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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