I am making a GET request to a WebAPI and returning an object like so: http://s12.postimg.org/leoykz3rh/debug1.png
However, when I am retrieving the object on the client side, the objects in Elements are empty with no structure: http://s12.postimg.org/cie6h1d59/debug2.jpg
Here is the class definition of the objects contained in Elements
public class LineElement
{
int ID { get; set; }
int X { get; set; }
int Y { get; set; }
int W { get; set; }
int H { get; set; }
string Code { get; set; }
string Color { get; set; }
public LineElement(int pID, int? pX, int? pY, int? pW, int? pH, string pCode, string pColor)
{
ID = pID;
X = Convert.ToInt16(pX);
Y = Convert.ToInt16(pY);
W = Convert.ToInt16(pW);
H = Convert.ToInt16(pH);
Code = pCode;
Color = pColor;
}
}
They are added to Elements like so:
var elemList = new List<LineElement>(); // list of LineElements to return
for (var i = 0; i < r.Count(); i++)
{
elemList.Add(new LineElement(r[i].ID, r[i].P_L, r[i].P_T, r[i].P_W, r[i].P_H, r[i].Code.ToString(), r[i].GetSColor()));
}
And as you can see from the VS debugger screenshot, the object looks fine on the server-side. Any thoughts on what may be happening during serialization or de-serialization?
Also, I have tested the serialization by passing it back to the client using IHttpActionResult which gives me the same result.
return Ok(response);
Thanks