Пример #1
0
        public static string ToCompactJson([CanBeNull] this object instance)
        {
            var settings = CreateSerializationSettings();

            settings.Formatting = Formatting.None;
            var json = JsonConvert.SerializeObject(instance, settings);

            // TODO discuss this replacement (seb)
            json = new SSTTypeNameShortener().RemoveDetails(json);
            return(json);
        }
Пример #2
0
        public static string ToFormattedJson([CanBeNull] this object instance)
        {
            var settings = CreateSerializationSettings();

            settings.Formatting = Formatting.Indented;
            var json = SerializeWithCustomIndentationDepth(instance, settings);

            // TODO discuss this replacement (seb)
            json = new SSTTypeNameShortener().RemoveDetails(json);
            return(json);
        }