JsConfig
Assembly: ServiceStack.Text.dll
View Source
public static class JsConfig
Properties
HasInit
View Source
public static bool HasInit { get; }
UTF8Encoding
View Source
public static UTF8Encoding UTF8Encoding { get; set; }
DateTimeFormat
View Source
public static string DateTimeFormat { get; set; }
ConvertObjectTypesIntoStringDictionary
View Source
public static bool ConvertObjectTypesIntoStringDictionary { get; set; }
TryToParsePrimitiveTypeValues
View Source
public static bool TryToParsePrimitiveTypeValues { get; set; }
TryToParseNumericType
View Source
public static bool TryToParseNumericType { get; set; }
TryParseIntoBestFit
View Source
public static bool TryParseIntoBestFit { get; set; }
ParsePrimitiveFloatingPointTypes
View Source
public static ParseAsType ParsePrimitiveFloatingPointTypes { get; set; }
ParsePrimitiveIntegerTypes
View Source
public static ParseAsType ParsePrimitiveIntegerTypes { get; set; }
ExcludePropertyReferences
View Source
public static string[] ExcludePropertyReferences { get; set; }
ExcludeDefaultValues
View Source
public static bool ExcludeDefaultValues { get; set; }
IncludeNullValues
View Source
public static bool IncludeNullValues { get; set; }
IncludeNullValuesInDictionaries
View Source
public static bool IncludeNullValuesInDictionaries { get; set; }
IncludeDefaultEnums
View Source
public static bool IncludeDefaultEnums { get; set; }
TreatEnumAsInteger
View Source
public static bool TreatEnumAsInteger { get; set; }
ExcludeTypeInfo
View Source
public static bool ExcludeTypeInfo { get; set; }
IncludeTypeInfo
View Source
public static bool IncludeTypeInfo { get; set; }
Indent
View Source
public static bool Indent { get; set; }
TypeAttr
View Source
public static string TypeAttr { get; set; }
TypeWriter
View Source
public static Func<Type, string> TypeWriter { get; set; }
TypeFinder
View Source
public static Func<string, Type> TypeFinder { get; set; }
ParsePrimitiveFn
View Source
public static Func<string, object> ParsePrimitiveFn { get; set; }
DateHandler
View Source
public static DateHandler DateHandler { get; set; }
TimeSpanHandler
Sets which format to use when serializing TimeSpans
View Source
public static TimeSpanHandler TimeSpanHandler { get; set; }
TextCase
Text case to use for property names (Default = PascalCase)
View Source
public static TextCase TextCase { get; set; }
EmitCamelCaseNames
Emitting camelCase for property names
View Source
[Obsolete("Use TextCase = TextCase.CamelCase")]
public static bool EmitCamelCaseNames { get; set; }
EmitLowercaseUnderscoreNames
Emitting lowercase_underscore_casing for property names
View Source
[Obsolete("Use TextCase = TextCase.SnakeCase")]
public static bool EmitLowercaseUnderscoreNames { get; set; }
PropertyConvention
Define how property names are mapped during deserialization
View Source
public static PropertyConvention PropertyConvention { get; set; }
ThrowOnError
Gets or sets a value indicating if the framework should throw serialization exceptions
or continue regardless of serialization errors. If true
the framework
will throw; otherwise, it will parse as many fields as possible. The default is false
.
View Source
public static bool ThrowOnError { get; set; }
ThrowOnDeserializationError
View Source
[Obsolete("Renamed to ThrowOnError")]
public static bool ThrowOnDeserializationError { get; set; }
AlwaysUseUtc
Gets or sets a value indicating if the framework should always convert System.DateTime
to UTC format instead of local time.
View Source
public static bool AlwaysUseUtc { get; set; }
SkipDateTimeConversion
Gets or sets a value indicating if the framework should skip automatic System.DateTime
conversions.
Dates will be handled literally, any included timezone encoding will be lost and the date will be treaded as DateTimeKind.Local
Utc formatted input will result in DateTimeKind.Utc output. Any input without TZ data will be set DateTimeKind.Unspecified
This will take precedence over other flags like AlwaysUseUtc
JsConfig.DateHandler = DateHandler.ISO8601 should be used when set true for consistent de/serialization.
View Source
public static bool SkipDateTimeConversion { get; set; }
AssumeUtc
Gets or sets a value indicating if the framework should always assume System.DateTime
is in UTC format if Kind is Unspecified.
View Source
public static bool AssumeUtc { get; set; }
AppendUtcOffset
Gets or sets whether we should append the Utc offset when we serialize Utc dates. Defaults to no. Only supported for when the JsConfig.DateHandler == JsonDateHandler.TimestampOffset
View Source
public static bool AppendUtcOffset { get; set; }
EscapeUnicode
Gets or sets a value indicating if unicode symbols should be serialized as "\uXXXX".
View Source
public static bool EscapeUnicode { get; set; }
EscapeHtmlChars
Gets or sets a value indicating if HTML entity chars [> < & = '] should be escaped as "\uXXXX".
View Source
public static bool EscapeHtmlChars { get; set; }
OnDeserializationError
Gets or sets a value indicating if the framework should call an error handler when an exception happens during the deserialization.
View Source
public static DeserializationErrorDelegate OnDeserializationError { get; set; }
PreferInterfaces
If set to true, Interface types will be preferred over concrete types when serializing.
View Source
public static bool PreferInterfaces { get; set; }
IncludePublicFields
If set to true, Interface types will be preferred over concrete types when serializing.
View Source
public static bool IncludePublicFields { get; set; }
MaxDepth
Sets the maximum depth to avoid circular dependencies
View Source
public static int MaxDepth { get; set; }
ModelFactory
Set this to enable your own type construction provider. This is helpful for integration with IoC containers where you need to call the container constructor. Return null if you don't know how to construct the type and the parameterless constructor will be used.
View Source
public static EmptyCtorFactoryDelegate ModelFactory { get; set; }
ExcludeTypes
View Source
public static HashSet<Type> ExcludeTypes { get; set; }
ExcludeTypeNames
View Source
public static HashSet<string> ExcludeTypeNames { get; set; }
IgnoreAttributesNamed
View Source
public static string[] IgnoreAttributesNamed { get; set; }
AllowRuntimeTypeWithAttributesNamed
View Source
public static HashSet<string> AllowRuntimeTypeWithAttributesNamed { get; set; }
AllowRuntimeTypeWithInterfacesNamed
View Source
public static HashSet<string> AllowRuntimeTypeWithInterfacesNamed { get; set; }
AllowRuntimeTypeInTypes
View Source
public static HashSet<string> AllowRuntimeTypeInTypes { get; set; }
AllowRuntimeTypeInTypesWithNamespaces
View Source
public static HashSet<string> AllowRuntimeTypeInTypesWithNamespaces { get; set; }
AllowRuntimeType
View Source
public static Func<Type, bool> AllowRuntimeType { get; set; }
Fields
TreatValueAsRefTypes
View Source
public static HashSet<Type> TreatValueAsRefTypes
Methods
InitStatics()
View Source
public static void InitStatics()
Init()
Mark JsConfig global config as initialized and assert it's no longer mutated
View Source
public static void Init()
Init(Config)
Initialize global config and assert that it's no longer mutated
View Source
public static void Init(Config config)
Parameters
Type | Name |
---|---|
ServiceStack.Text.Config | config |
BeginScope()
View Source
public static JsConfigScope BeginScope()
Returns
ServiceStack.Text.JsConfigScope
CreateScope(String, JsConfigScope)
View Source
public static JsConfigScope CreateScope(string config, JsConfigScope scope = null)
Returns
ServiceStack.Text.JsConfigScope
Parameters
Type | Name |
---|---|
System.String | config |
ServiceStack.Text.JsConfigScope | scope |
With(Config)
View Source
public static JsConfigScope With(Config config)
Returns
ServiceStack.Text.JsConfigScope
Parameters
Type | Name |
---|---|
ServiceStack.Text.Config | config |
With(Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>, Nullable<ParseAsType>, Nullable<ParseAsType>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>, Nullable<DateHandler>, Nullable<TimeSpanHandler>, Nullable<PropertyConvention>, Nullable<Boolean>, Nullable<Boolean>, String, String, Func<Type, String>, Func<String, Type>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Int32>, EmptyCtorFactoryDelegate, String[], Nullable<Boolean>)
View Source
[Obsolete("Use JsConfig.With(new Config { })")]
public static JsConfigScope With(bool? convertObjectTypesIntoStringDictionary = null, bool? tryToParsePrimitiveTypeValues = null, bool? tryToParseNumericType = null, ParseAsType? parsePrimitiveFloatingPointTypes = null, ParseAsType? parsePrimitiveIntegerTypes = null, bool? excludeDefaultValues = null, bool? includeNullValues = null, bool? includeNullValuesInDictionaries = null, bool? includeDefaultEnums = null, bool? excludeTypeInfo = null, bool? includeTypeInfo = null, bool? emitCamelCaseNames = null, bool? emitLowercaseUnderscoreNames = null, DateHandler? dateHandler = null, TimeSpanHandler? timeSpanHandler = null, PropertyConvention? propertyConvention = null, bool? preferInterfaces = null, bool? throwOnDeserializationError = null, string typeAttr = null, string dateTimeFormat = null, Func<Type, string> typeWriter = null, Func<string, Type> typeFinder = null, bool? treatEnumAsInteger = null, bool? skipDateTimeConversion = null, bool? alwaysUseUtc = null, bool? assumeUtc = null, bool? appendUtcOffset = null, bool? escapeUnicode = null, bool? includePublicFields = null, int? maxDepth = null, EmptyCtorFactoryDelegate modelFactory = null, string[] excludePropertyReferences = null, bool? useSystemParseMethods = null)
Returns
ServiceStack.Text.JsConfigScope
Parameters
Type | Name |
---|---|
System.Nullable<System.Boolean> | convertObjectTypesIntoStringDictionary |
System.Nullable<System.Boolean> | tryToParsePrimitiveTypeValues |
System.Nullable<System.Boolean> | tryToParseNumericType |
System.Nullable<ServiceStack.Text.ParseAsType> | parsePrimitiveFloatingPointTypes |
System.Nullable<ServiceStack.Text.ParseAsType> | parsePrimitiveIntegerTypes |
System.Nullable<System.Boolean> | excludeDefaultValues |
System.Nullable<System.Boolean> | includeNullValues |
System.Nullable<System.Boolean> | includeNullValuesInDictionaries |
System.Nullable<System.Boolean> | includeDefaultEnums |
System.Nullable<System.Boolean> | excludeTypeInfo |
System.Nullable<System.Boolean> | includeTypeInfo |
System.Nullable<System.Boolean> | emitCamelCaseNames |
System.Nullable<System.Boolean> | emitLowercaseUnderscoreNames |
System.Nullable<ServiceStack.Text.DateHandler> | dateHandler |
System.Nullable<ServiceStack.Text.TimeSpanHandler> | timeSpanHandler |
System.Nullable<ServiceStack.Text.PropertyConvention> | propertyConvention |
System.Nullable<System.Boolean> | preferInterfaces |
System.Nullable<System.Boolean> | throwOnDeserializationError |
System.String | typeAttr |
System.String | dateTimeFormat |
System.Func<System.Type,System.String> | typeWriter |
System.Func<System.String,System.Type> | typeFinder |
System.Nullable<System.Boolean> | treatEnumAsInteger |
System.Nullable<System.Boolean> | skipDateTimeConversion |
System.Nullable<System.Boolean> | alwaysUseUtc |
System.Nullable<System.Boolean> | assumeUtc |
System.Nullable<System.Boolean> | appendUtcOffset |
System.Nullable<System.Boolean> | escapeUnicode |
System.Nullable<System.Boolean> | includePublicFields |
System.Nullable<System.Int32> | maxDepth |
ServiceStack.EmptyCtorFactoryDelegate | modelFactory |
System.String[] | excludePropertyReferences |
System.Nullable<System.Boolean> | useSystemParseMethods |
GetConfig()
View Source
public static Config GetConfig()
Returns
ShouldExcludePropertyType(Type)
View Source
public static bool ShouldExcludePropertyType(Type propType)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Type | propType |
Reset()
View Source
public static void Reset()