I'm trying to download json data where one of the attributes is "easting". For the majority of the json dataset, "easting" is an integer, but there are a handful of cases in which "easting" is a list of integers as shown below:
"easting" : 357570 ,
...
"easting" : [ 434939, 434942 ] ,
My original code had anticipated "easting" to be an int when its class was declared as follows:
public class Item
{
public int easting { get; set; }
}
However, I keep getting errors saying that I cannot convert a type int to a type int []. If I adjust the class definition to allow easting to be of type int [], I simply get the reverse error - I cannot convert a type int [] to a type int.
How can I go about handling this? Is there any way to account for a varying input datatype during the deserialization process?