I am able to return an JSON arrray from a WCF rest service.
[ {"Name" : "john", "age" : 23 }, {"Name" : "Petter", "age" : 21 } ]
but how can I add a name to the array. In this case, I want to add the “People” to the beginning of the array
{"People" : [ {"Name" : "john", "age" : 23 }, {"Name" : "Petter", "age" : 21 } ]}
return an object that has a people field whose value is an array of your name/age objects.
For example
This assumes Person is the class you’re returning in your array, for example: