【发布时间】:2018-04-01 10:10:54
【问题描述】:
如何在 F# 中将 JSON 序列化为元组(反之亦然)?
JSON 架构
{
"name": "test",
"type": "document",
"id": "e3c7373c-f4bc-4ffa-9a01-7c7d9f83e4cf"
}
元组
let document = ("test", "document", "e3c7373c-f4bc-4ffa-9a01-7c7d9f83e4cf")
理想情况下使用DataContractJsonSerializer
【问题讨论】:
-
元组
("test", "document")应该看到什么JSON? -
抱歉没听明白,问题是关于将 JSON 序列化为元组
-
我的意思是——会有信息丢失。所以这不是“序列化”,因为根据定义,“序列化”必须是可重构的。例如:
{"name": "test", "type": "doc" }最好是(string * obj) * (string * obj)/
标签: f# datacontractjsonserializer