Hi folks,
i've got an IList<Foo>
and I'm trying to serialize it as Json
without the field names included in the result. As such, i'm trying to create an anonymous object, which i pass to the Json serialization method.
Foo is defined as (pseudo code):-
public class Foo
{
public int X;
public int Y;
}
When i return this as Json ...
return Json(foos);
the result is like
... [{"X":1,"Y":2},{"X":3,"Y":4}...]
I don't want the X and Y to be there. So i'm after..
... [{1,2},{3,4}...]
So i was trying to do the following (which doesn't work)
(from p in foos
select new p.X + "," + p.Y).ToArray()
or
(from p in foos
select new string(p.X+ "," + p.Y)).ToArray()
but to no avail (doesn't compile).
Can anyone help, please?