I'm using json quite rarely, so I'm sorry if I didn't get all the namings right.
I have a predefined json string which contains a large number of points (x, y; integer), these points are contained in "value". Each point is a list of 2 values in JSON.
Stripped down to the main content the json string looks like this:
{"values":[[3621,67],[445,117]],"more_key":"move_value","much_more_key":"much_move_value"}
What I go working is this:
public class RootObject
{
public List<int[]> values { get; set; }
public string more_key { get; set; }
public string much_more_key { get; set; }
}
using the following line to deserialize (and serialize later on):
_rootObject = JsonConvert.DeserializeObject<RootObject>(jsonString);
...
JsonConvert.SerializeObject(_rootObject);
But I do not want a list of int arrays. I would like to get a list of (point) objects. What I would like to get working is something like this:
public class RootObject
{
public List<MyPoint> values { get; set; }
public string more_key { get; set; }
public string much_more_key { get; set; }
}
public class MyPoint
{
public int x;
public int y;
// more member variables not from json
public bool notFromJSON;
}
So far I didn't find a way to accomplish this.
Between Deserializing and Serializing would like to do some work with this list of MyPoint and need additional members in this class.
Any hints how to get to this would be appreciated.