Switch/Case block for JSON?
Switch/Case block for JSON?
I asked this in irc last night but went to sleep soon after! How do I go about doing a switch/case block for JSONData? Like for XML I go "SFSObject dataObj = (SFSObject)data (where data is an object input of OnExtensionResponse" and "dataObj.GetString("cmd")". How do I do this same thing for JSONData?
To clarify, I can do this for xml:
But not for JSON, it seems.
Code: Select all
void OnExtensionResponse(object data, string type)
{
if (type == SmartFoxClient.XTMSG_TYPE_XML)
{
SFSObject xmlObj = (SFSObject)data;
switch (xmlObj.GetString("cmd"))
{
case "actorMoveGet":
networkPlayer.ActorMove();
break;
case "actorMoveSet":
networkPlayer.ActorMove();
break;
}
}
}
But not for JSON, it seems.
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
Hey Duke
Hope you got it solved with the help in irc.
For everyone else looking at jsondata object, check out the litjson manual - example 1.2
http://litjson.sourceforge.net/doc/manual.html
/Thomas
Hope you got it solved with the help in irc.
For everyone else looking at jsondata object, check out the litjson manual - example 1.2
http://litjson.sourceforge.net/doc/manual.html
/Thomas
Return to “.Net / Unity3D API”
Who is online
Users browsing this forum: No registered users and 27 guests