c# - Parse JSON block with dynamic variables -


i'm grabbing json object url , parsing json.net. able parse blocks of data defined variables fine, when comes random collection of var:value - i'm stuck.

example(loosely typed):

{"fname":"joe","lname":"doe",
"bodytype":{"height":180,"weight":"200","race":"white","hair":"black"},
"belongings":{"shirt":"black","money":15,"randomthing":"anyvar"},
"signs":{"tattoo":0,"scar":"forehead","glasses":"dorky"}
}

i'm casting to

class person
{
public string fname;
public string lname;
public bodytype bodytype;
public ????? belongings;
public ????? signs;
}
how handle belongings , signs if cannot predict properties?

well, they're sure json objects, right, , json objects associative arrays mapping strings something. i'd represent them dictionary<string, dynamic> -- map of strings somethings.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -