在ASP MVC 4解析JSON文本到C#对象文本、对象、ASP、MVC

2023-09-03 16:25:26 作者:夜雪尽马蹄轻

我有一个巨大的量我想将它们保存在数据库自定义属性,我很困惑,如何将它们存储在数据库中,我想将它们存储由

I have a huge amount of customized attributes I want to save them in the DataBase, I was confused of how to store them in the database, i thought of storing them as a string separating them by

= =>名称,值)(; =>属性,属性),但code为不优雅了!

(= => name , value) (; => attribute , attribute) but the code wasn't elegant at all!

所以我STAT想保存为的Json 字符串,但我无法找到一个 的Json对象解析器

so i stat thinking of saving them as Json string but I couldn't found a Json to object parser

,而我们只需要调用 JSON()来解析对象JSON字符串

while we need only to call json() to parse object to json string

有没有比使用JSON字符串更好的办法,是有提供JSON字符串解析器?

is there a better way than using json string and is there json string parser provided ?

推荐答案

很多人用 Json.net 进行序列化

var log  = JsonConvert.DeserializeObject<YourObject>(logJson)

和其他方向

  var logJson = JsonConvert.SerializeObject(log);
 
精彩推荐
图片推荐