我有一個json模式,我需要將它轉換爲C#對象或至少將其轉換爲json字符串。將Json Schema反序列化爲Json字符串或對象
有沒有辦法通過代碼或使用某種工具來做到這一點?
爲Json我目前使用Json.net
。
這是我的架構之一:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "UserGroupWsDTO",
"type": "object",
"properties":
{
"members":
{
"type": "array",
"items":
{
"type": "object",
"properties":
{
"uid":
{
"type": "string"
}
}
}
},
"uid":
{
"type": "string"
},
"name":
{
"type": "string"
}
}
}
我需要這個創建反序列化對象的JSON
編輯 我的JSON模式的版本是4和JSON Schema來POCO沒有按」 t支持它
轉到http://json2csharp.com/並粘貼你的json - 所有的類都將爲你創建。 – Ric
可能重複[從JSON模式生成C#類](http://stackoverflow.com/questions/6358745/generate-c-sharp-classes-from-json-schema) – eoinmullan
我不能使用json2csharp,因爲我有一個Json架構。 – frenk91