Пример #1
0
            private string ResolveObject(object target, int depth)
            {
                var targetType = target.GetType();
                var fields     = _options.GetProperties(targetType);

                if (fields.Count == 0 && string.IsNullOrWhiteSpace(_options.TypeSpecifier))
                {
                    return(EmptyObjectLiteral);
                }

                // If we arrive here, then we convert the object into a
                // dictionary of property names and values and call the serialization
                // function again
                var objectDictionary = CreateDictionary(fields, targetType.ToString(), target);

                return(Serialize(objectDictionary, depth, _options));
            }