This project has moved and is read-only. For the latest updates, please go here.

Object Serialization to JSON, how to serialize Attributes (like XML)

Apr 18, 2011 at 5:24 AM

Hi Everybody,

I am a Newbie to Json, I just started using Json.NET from today.

I was looking for a way to convert XML to JSON and landed in Json.NET.

I have a class that I serialize to XML and then convert to JSON, but this is hampering performance. So I started using [JsonProperty] attributes inside my class to convert to JSON.

I have few attributes which are a part of XML Element, But How to I serialize XML Attributes from my objects to JSON? We have [XMLAttribute] for this in XML, is there anything equivalent in JSON.NET?

sample object:

<headClass id="123 type="simple">


Thanks in advance