-edit- Maybe there is a solution using attributes?
I found the weirdest json. It looks like the line below. The only way I can handle it is to use an array of objects. I have never seen ints and strings mix in the array below.
Then it forces me to type. Is there a better way to get int and string?
NOTE. The first array can contain from 0 to 20 elements. Inside the ALWAYS array, there are 3, with the first two being ints and the third being a string. Maybe I can use this knowledge to my advantage?
{
var ser = new JavaScriptSerializer();
var o = ser.Deserialize<RootObj>(@"{""resources"": [[123,567,""<div ...""]]}");
var o2 = o.resources[0];
var v = (int)o2[1];
var sz = (string)o2[2];
}
class RootObj {
public object[][] resources;
}
user34537
source
share