I am having difficulty with serialisation. I have an aspx page that uses an ajax call to return objects from the server side.
Desired output
ModelPoints=[[1,2,3],[1,2,3],[1,2,3],[1,2,3],[1,2,3]] (for WebGL)
Actual output ModelPoints={{Points=[1,2,3]},{Points=[1,2,3]},{Points=[1,2,3]},{Points=[1,2,3]}}
The application flow is
Ajax -> Aspx -> WCF -> Aspx -> Ajax
Below are the classes that are being serialized incorrectly. How do i restructure this so that it works? I do not want to parse 18000+ pts more than once, so the output from the server should be the correct format. i.e. I cannot afford to parse it on the client side.
The object name Points comes from the parameter name, how to do this for a 2D array of floats.
The classes below
[Serializable()]
public class ModelPoint
{
public ModelPoint()
{
}
public ModelPoint(float x, float y, float z)
{
_points = new List<Nullable<float>>();
_points.Add(x);
_points.Add(y);
_points.Add(z);
}
private List<Nullable<float>> _points;
public List<Nullable<float>> Points
{
get {return _points;}
set { _points = value; }
}
}
[Serializable()]
public class Model
{
private List<ModelPoint> _modelPoints;
[System.Xml.Serialization.XmlArray("ModelPoints", IsNullable = true)]
[System.Xml.Serialization.XmlArrayItem()]
public List<ModelPoint> ModelPoints
{
get {return _modelPoints;}
set { _modelPoints = value; }
}
}