【发布时间】:2016-10-21 14:19:14
【问题描述】:
目前在我们的项目中,我们有一个具有字符串描述的特定类。
此外,我们还有一个对象。
Object Foo {
Apple: {parts: 5},
Description: theproblematicobject,
,,,,
}
描述被设置为类型字符串。因此,需要将对象序列化为描述的值。
最后,我们将 foo 作为 JSONConvert.serializer(foo) 返回。
收到后,对象 foo 的格式很好 JSON,但描述仍然是一个序列化的字符串。
是否有我可以使用的函数组合如何序列化有问题的对象(因此它适合字符串类型),并且根据请求反序列化,它会变成一个格式良好的 json 而不是。
结果:
"Name": "Friday, 21 October 2016 New...",
"Description": "{\"HoursList\":[],\"EmployeeFullname\":\"..........",
"SwipeLeftAction": null,
"SwipeLeftDescription": null,
"SwipeLeftColor": null,
"SwipeRightAction": null,
"SwipeRightDescription": null,
"SwipeRightColor": null,
"ClickAction": "uiweb/em......."
}
希望:
"Name": "Friday, 21 October 2016 New...",
"Description": {"HoursList":[],
"EmployeeFullname" : ".........."
}
"SwipeLeftAction": null,
"SwipeLeftDescription": null,
"SwipeLeftColor": null,
"SwipeRightAction": null,
"SwipeRightDescription": null,
"SwipeRightColor": null,
"ClickAction": "uiweb/em......."
}
【问题讨论】:
标签: javascript c# json serialization