internal static Object decodeJSONObject(object jsonDicParameter) { //check array if (jsonDicParameter is IList) { ArrayList tmpArrayList = new ArrayList(); List <object> objList = new List <object> (); objList = (List <object>)jsonDicParameter; //NCMBDebug.Log (" Check list!!"); object objTmp = null; for (int i = 0; i < objList.Count; i++) // Loop through List with for //NCMBDebug.Log (" List item " + objList [i]); { objTmp = decodeJSONObject(objList [i]); if (objTmp != null) { tmpArrayList.Add(decodeJSONObject(objList [i])); } else { tmpArrayList.Add(objList [i]); } } return(tmpArrayList); } //check if json or not Dictionary <string, object> jsonDic; if ((jsonDicParameter is IDictionary)) { jsonDic = (Dictionary <string, object>)jsonDicParameter; } else { return(null); } object typeString; jsonDic.TryGetValue("__type", out typeString); /* * if (typeString == null) { * return jsonDic; * } */ if (typeString == null) //Dictionary { Dictionary <string, object> tmpDic = new Dictionary <string, object> (); object decodeObj; foreach (KeyValuePair <string, object> pair in jsonDic) { decodeObj = decodeJSONObject(pair.Value); if (decodeObj != null) { //NCMBDebug.Log ("[TEST:" + pair.Key + " VALUE:" + pair.Value); tmpDic.Add(pair.Key, decodeObj); } else { tmpDic.Add(pair.Key, pair.Value); } } //return jsonDic; return(tmpDic); } if (typeString.Equals("Date")) { object iso; jsonDic.TryGetValue("iso", out iso); return(parseDate((string)iso)); } if (typeString.Equals("Pointer")) { object className; jsonDic.TryGetValue("className", out className); object objectId; jsonDic.TryGetValue("objectId", out objectId); return(NCMBObject.CreateWithoutData((string)className, (string)objectId)); } if (typeString.Equals("GeoPoint")) { double latitude = 0; double longitude = 0; try { object latitudeString; jsonDic.TryGetValue("latitude", out latitudeString); latitude = (double)Convert.ToDouble(latitudeString); object longitudeString; jsonDic.TryGetValue("longitude", out longitudeString); longitude = Convert.ToDouble(longitudeString); } catch (Exception e) { throw new NCMBException(e); } return(new NCMBGeoPoint(latitude, longitude)); } if (typeString.Equals("Object")) { object className; jsonDic.TryGetValue("className", out className); NCMBObject output = NCMBObject.CreateWithoutData((string)className, null); output._handleFetchResult(true, jsonDic); return(output); } //Relation対象クラスを増やす時は要注意 if (typeString.Equals("Relation")) { if (jsonDic ["className"].Equals("user")) { return(new NCMBRelation <NCMBUser> ((string)jsonDic ["className"])); } else if (jsonDic ["className"].Equals("role")) { return(new NCMBRelation <NCMBRole> ((string)jsonDic ["className"])); } else { return(new NCMBRelation <NCMBObject> ((string)jsonDic ["className"])); } } return(null); }