예제 #1
0
        public override JSONObject toJSONObject()
        {
            JSONObject[] array = new JSONObject[l.Count];
            int          i     = 0;

            foreach (var o in this.l.getSerializable())
            {
                array[i] = JSONSerializer.Serialize(o);
                i++;
            }
            return(new JSONObject(array));
        }
예제 #2
0
        /// <summary>
        /// JSon serialization things
        /// </summary>

        public JSONObject toJSONObject()
        {
            JSONObject json = new JSONObject();

            json.AddField("name", name);
            JSONObject parameters = new JSONObject();

            foreach (KeyValuePair <string, object> entry in args)
            {
                if (entry.Value is JSONAble)
                {
                    var jsonAble = entry.Value as JSONAble;
                    parameters.AddField(entry.Key, JSONSerializer.Serialize(jsonAble));
                }
                else if (entry.Value is Object)
                {
                    var o = entry.Value as Object;
                    parameters.AddField(entry.Key, o.GetInstanceID());
                }
                else
                {
                    var val = IsoUnityTypeFactory.Instance.getIsoUnityType(entry.Value);
                    if (val != null && val is JSONAble)
                    {
                        parameters.AddField(entry.Key, JSONSerializer.Serialize(val));
                    }
                    else
                    {
                        parameters.AddField(entry.Key, entry.Value.ToString());
                    }
                }
            }


            json.AddField("parameters", parameters);
            return(json);
        }
예제 #3
0
        /// <summary>
        /// JSon serialization things
        /// </summary>

        public JSONObject toJSONObject()
        {
            JSONObject json = new JSONObject();

            json.AddField("name", name);
            JSONObject parameters = new JSONObject();

            foreach (KeyValuePair <string, Object> entry in args)
            {
                if (entry.Value is JSONAble)
                {
                    var jsonAble = entry.Value as JSONAble;
                    parameters.AddField(entry.Key, JSONSerializer.Serialize(jsonAble));
                }
                else
                {
                    parameters.AddField(entry.Key, entry.Value.GetInstanceID());
                }
            }


            json.AddField("parameters", parameters);
            return(json);
        }