本文介绍了控制台应用程序ASP中的JSON反序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试对给定的字符串进行反序列化
我的代码在这里
I am trying to Deserialization of the given string
My code goes here
using System.Runtime.Serialization.Json;
using System.Runtime.Serialization;
public class TestL
{
public string RESULT { get; set; }
public string TYPES { get; set; }
public string HEADER { get; set; }
public string ROW { get; set; }
}
class Program
{
static void Main(string[] args)
{
var jsonString = "[{\"RESULT\":{\"TYPES\":[\"bigint\",\"varchar\",\"int\",\"int\",\"varchar\",\"varchar\",\"varchar\",\"varchar\",\"varchar\",\"varchar\",\"bigint\",\"varchar\",\"decimal\",\"decimal\",\"date\"],\"HEADER\":[\"kvk\",\"bedrijfsnaam\",\"kvks\",\"sub\",\"adres\",\"postcode\",\"plaats\",\"type\",\"status\",\"website\",\"vestiging\",\"rechtsvorm\",\"lat_rad\",\"lon_rad\",\"anbi\",\"ROWS\":[[\"273121520000\",\"Kinkrsoftware\",\"27312152\",\"0\",\"Oude Trambaan 7\",\"2265CA\",\"Leidschendam\",\"Hoofdvestiging\",null,\"kinkrsoftware.nl\",\"9789723\",null,null,null,null]]}}";
Object ooo= new Object();
ooo = JsonDeserialize<TestL>(jsonString);
Console.WriteLine(((JSONDemo.TestL)(ooo)).TYPES);
Console.ReadLine();
}
public static T JsonDeserialize<T>(string jsonString)
{
DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(T));
MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(jsonString));
T obj = (T)ser.ReadObject(ms);
return obj;
}
}
我无法反序列化我的数据
该数据是
select查询返回的列"select * from KVK limit 100"
请帮助我解除武装
在此先非常感谢
I cannot desearilize my data
this data is
a column return from select query "select * from KVK limit 100"
please help me to desearilize
A lot thanks in advance
推荐答案
这篇关于控制台应用程序ASP中的JSON反序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!