Пример #1
0
        private JsonSerializerOptions CreateJsonSerializerOptions(JsonSerializeOptions options)
        {
            if (options == null)
            {
                return(null);
            }

            return(new JsonSerializerOptions
            {
                WriteIndented = options.WriteIndented
            });
        }
Пример #2
0
        public string Serialize(object json, JsonSerializeOptions options = null)
        {
            var jsonSerializerOptions = CreateJsonSerializerOptions(options);

            return(JsonSerializer.Serialize(json, jsonSerializerOptions));
        }