JSON object in client side c#
JSON object in client side c#
When I receive an extension message on client side, how do I convert the c# object to JSON object? Or should I use SFSObject itself?
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
Hi
For a json object you simply cast the object to a JsonData object.
Check the manual here for further info on the actual JsonData object: http://litjson.sourceforge.net/doc/manual.html
I'll put on the todo to make the documentation of OnExtensionResponse a little more explicit with the 3 types of objects.
So in short (written directly here without testing, so a little disclaimer for typos):
Best
Thomas
For a json object you simply cast the object to a JsonData object.
Check the manual here for further info on the actual JsonData object: http://litjson.sourceforge.net/doc/manual.html
I'll put on the todo to make the documentation of OnExtensionResponse a little more explicit with the 3 types of objects.
So in short (written directly here without testing, so a little disclaimer for typos):
Code: Select all
public void OnExtensionResponse(object data, string type)
{
if (type == SmartFoxClient.XTMSG_TYPE_JSON)
{
JsonData responseObject = (JsonData)data;
// do something with responseObject
}
}
Best
Thomas
Return to “.Net / Unity3D API”
Who is online
Users browsing this forum: No registered users and 51 guests