I am trying to figure out this problem,
I want to transfer Json object using ArraySegment
my JSON Data is in this format
{"employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter", "lastName":"Jones"}
]}
I have used this tool to create specified class like
public class Employee
{
public string firstName { get; set; }
public string lastName { get; set; }
}
public class RootObject
{
public List<Employee> employees { get; set; }
}
now I am inserting data into object like this
var objectToSerialize = new RootObject();
objectToSerialize.items = new List<Employee>
{
new Item { firstName="abc", lastName="xyz"},
new Item { firstName="pqr", lastName="stu"}
};
but now I am facing problem, I don't know how to send it using websocket
through this
ArraySegment<byte> max = new ArraySegment<byte>(, , );
await webSocket.SendAsync(max, WebSocketMessageType.Text, true, CancellationToken.None);