c# convert a part of a json string to objects -
ive got problem decoding json output api.openkvk.nl. want rows converted objects, whats best way convert json rows list?
a json example is:
[{"result":{"types":["bigint","varchar","int","int","varchar","varchar","varchar","varchar","varchar","varchar","bigint","varchar","double","double","date"],"header":["kvk","bedrijfsnaam","kvks","sub","adres","postcode","plaats","type","status","website","vestiging","rechtsvorm","lat_rad","lon_rad","anbi"],"rows":[["170401310000","kuijpers installaties helmond b.v.","17040131",null,"panovenweg 18","5708hr","helmond","hoofdvestiging",null,null,"16667549",null,"0.89838484100000005","0.098222471000000006",null],["170401310001","kuijpers installaties b.v.","17040131",null,"veldzigt 18","3454pw","de meern","nevenvestiging","vestiging uitgeschreven uit het handelsregister",null,"0",null,null,null,null],["170401310002","kuijpers installaties helmond b.v.","17040131",null,"heieinde 12","5047sx","tilburg","nevenvestiging",null,null,"21790299",null,"0.90039840900000001","0.087662925000000003",null]]}}]
object:
public class kvk { public int64? kvk { get; set; } public string bedrijfsnaam { get; set; } public int? kvks { get; set; } public int? sub { get; set; } public string adres { get; set; } public string postcode { get; set; } public string plaats { get; set; } public string type { get; set; } public string status { get; set; } public string website { get; set; } public int? vestiging { get; set; } public string rechtsvorm { get; set; } public decimal? lat_rad { get; set; } public decimal? lon_rad { get; set; } public datetime? anbi { get; set; } }
the idea use javascriptserializer.deserialize<> not working..
var list = new javascriptserializer().deserialize<list<root>>(json); public class result { public list<string> types { get; set; } public list<string> header { get; set; } public list<list<string>> rows { get; set; } } public class root { public result result { get; set; } }
Comments
Post a Comment