예제 #1
0
        protected override void WriteAdditionalPropertyInformation(JsonWriter writer, PropertyInfoContainer propertyInfoContainer, JsonSerializer serializer)
        {
            if (!propertyInfoContainer.IsValue)
            {
                var typeContainer = TypeInfoContainer.Create(propertyInfoContainer.Type);

                writer.WritePropertyName("TypeDefinition");

                serializer.Serialize(writer, typeContainer);
            }
        }
예제 #2
0
        public string Serialize(Type type)
        {
            var typeContainer = TypeInfoContainer.Create(type);

            var converters = JsonHelper.GetAssemblyDefinedConverters(Assembly.GetExecutingAssembly()).ToList();

            converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter());

            var json = JsonConvert.SerializeObject(typeContainer, Formatting.Indented, converters.ToArray());

            return(json);
        }