public void Serialize(JsonFormatter f, JsonSchemaValidationContext c, Object o)
        {
            // validate properties
            m_validValueMap.Clear();
            foreach (var kv in Properties)
            {
                var value = o.GetValueByKey(kv.Key);
                var v     = kv.Value.Validator;
                using (c.Push(kv.Key))
                {
                    if (v != null && v.Validate(c, value) == null)
                    {
                        m_validValueMap.Add(kv.Key, value);
                    }
                }
            }

            using (f.BeginMapDisposable())
            {
                foreach (var kv in Properties)
                {
                    object value;
                    if (!m_validValueMap.TryGetValue(kv.Key, out value))
                    {
                        continue;
                    }

                    string[] dependencies;
                    if (Dependencies.TryGetValue(kv.Key, out dependencies))
                    {
                        // check dependencies
                        bool hasDependencies = true;
                        foreach (var x in dependencies)
                        {
                            if (!m_validValueMap.ContainsKey(x))
                            {
                                hasDependencies = false;
                                break;
                            }
                        }
                        if (!hasDependencies)
                        {
                            continue;
                        }
                    }

                    // key
                    f.Key(kv.Key);

                    // value
                    using (c.Push(kv.Key))
                    {
                        kv.Value.Validator.Serialize(f, c, value);
                    }
                }
            }
        }
        public void Serialize(JsonFormatter f, JsonSchemaValidationContext c, Object o)
        {
            // validate properties
            m_validValueMap.Clear();

            using (f.BeginMapDisposable())
            {
                var dict = o as Dictionary <string, T>;
                foreach (var kv in dict)
                {
                    // key
                    f.Key(kv.Key);

                    // value
                    using (c.Push(kv.Key))
                    {
                        AdditionalProperties.Validator.Serialize(f, c, kv.Value);
                    }
                }
            }
        }