Exemple #1
0
        public JsonValueCollection AddArray(string key)
        {
            var arr = new JsonValueCollection();

            Entries.Add(key, arr);
            return(arr);
        }
Exemple #2
0
        public JsonValueCollection AddArray()
        {
            JsonValueCollection ArrayValue = new JsonValueCollection();

            Add(ArrayValue);

            return(ArrayValue);
        }
Exemple #3
0
        private static void Value(this IJsonWriter writer, IJsonValue?value)
        {
            if (value == null)
            {
                writer.Value(null);
            }
            else if (value.Type == Json.Type.Object)
            {
                writer.Object((JsonObject)value);
            }
            else if (value.Type == Json.Type.Array)
            {
                writer.ArrayStart();

                JsonValueCollection ArrayValue = (JsonValueCollection)value;
                foreach (IJsonValue ChildValue in ArrayValue)
                {
                    writer.Value(ChildValue);
                }

                writer.ArrayEnd();
            }
            else if (value.Type == Json.Type.String)
            {
                writer.Value(((JsonString)value).String);
            }
            else if (value.Type == Json.Type.Integer)
            {
                writer.Value(((JsonInteger)value).Number);
            }
            else if (value.Type == Json.Type.Float)
            {
                writer.Value(((JsonFloat)value).Number);
            }
            else if (value.Type == Json.Type.Boolean)
            {
                writer.Value(((JsonBool)value).Value);
            }
        }