json oschian_PowerJSON首页、文档和下载 - JSON 开发包 - OSCHINA - 中文开源技术交流社区...

PowerJSON 是 fastJSON 的一个扩展版本,提供一些新方法、类和接口,以及对发现的问题进行修复。详细列表请看这里。

示例代码:

// marks the internal DemoClass class deserializable

[JsonSerializable]

internal class DemoClass

{

// marks MyProperty property to be serialized to a field named "prop"

[JsonField ("prop")]

public string MyProperty { get; set; }

// marks MyEnumProperty property to be serialized to a field named "enum"

[JsonField ("enum")]

public MyEnum MyEnumProperty { get; set; }

// marks not to serialize the Number property, if its value is 0

[System.ComponentModel.DefaultValue (0)]

public int Number { get; set; }

// marks the serialized name of Identifier will be "a", if its type is ClassA,

//     and "b" for ClassB, and "variant" for other types

[JsonField ("a", typeof (ClassA))]

[JsonField ("b", typeof (ClassB))]

[JsonField ("variant")]

public object Identifier { get; set; }

// marks the InternalValue property will not be serialized

[JsonInclude (false)]

// marks the InternalValue property will not be deserialized

[System.ComponentModel.ReadOnly (true)]

public int InternalValue { get; set; }

}

public enum MyEnum

{

None,

// marks the serialized name of Vip to "VIP"

[JsonEnumValue ("VIP")]

Vip

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值