Skip to main content

JsConfig

Assembly: ServiceStack.Text.dll​
View Source​
Declaration
public static class JsConfig

Properties​

HasInit​

View Source​
Declaration
public static bool HasInit { get; }

UTF8Encoding​

View Source​
Declaration
public static UTF8Encoding UTF8Encoding { get; set; }

DateTimeFormat​

View Source​
Declaration
public static string DateTimeFormat { get; set; }

ConvertObjectTypesIntoStringDictionary​

View Source​
Declaration
public static bool ConvertObjectTypesIntoStringDictionary { get; set; }

TryToParsePrimitiveTypeValues​

View Source​
Declaration
public static bool TryToParsePrimitiveTypeValues { get; set; }

TryToParseNumericType​

View Source​
Declaration
public static bool TryToParseNumericType { get; set; }

TryParseIntoBestFit​

View Source​
Declaration
public static bool TryParseIntoBestFit { get; set; }

ParsePrimitiveFloatingPointTypes​

View Source​
Declaration
public static ParseAsType ParsePrimitiveFloatingPointTypes { get; set; }

ParsePrimitiveIntegerTypes​

View Source​
Declaration
public static ParseAsType ParsePrimitiveIntegerTypes { get; set; }

ExcludePropertyReferences​

View Source​
Declaration
public static string[] ExcludePropertyReferences { get; set; }

ExcludeDefaultValues​

View Source​
Declaration
public static bool ExcludeDefaultValues { get; set; }

IncludeNullValues​

View Source​
Declaration
public static bool IncludeNullValues { get; set; }

IncludeNullValuesInDictionaries​

View Source​
Declaration
public static bool IncludeNullValuesInDictionaries { get; set; }

IncludeDefaultEnums​

View Source​
Declaration
public static bool IncludeDefaultEnums { get; set; }

TreatEnumAsInteger​

View Source​
Declaration
public static bool TreatEnumAsInteger { get; set; }

ExcludeTypeInfo​

View Source​
Declaration
public static bool ExcludeTypeInfo { get; set; }

IncludeTypeInfo​

View Source​
Declaration
public static bool IncludeTypeInfo { get; set; }

Indent​

View Source​
Declaration
public static bool Indent { get; set; }

TypeAttr​

View Source​
Declaration
public static string TypeAttr { get; set; }

TypeWriter​

View Source​
Declaration
public static Func<Type, string> TypeWriter { get; set; }

TypeFinder​

View Source​
Declaration
public static Func<string, Type> TypeFinder { get; set; }

ParsePrimitiveFn​

View Source​
Declaration
public static Func<string, object> ParsePrimitiveFn { get; set; }

DateHandler​

View Source​
Declaration
public static DateHandler DateHandler { get; set; }

TimeSpanHandler​

Sets which format to use when serializing TimeSpans

View Source​
Declaration
public static TimeSpanHandler TimeSpanHandler { get; set; }

TextCase​

Text case to use for property names (Default = PascalCase)

View Source​
Declaration
public static TextCase TextCase { get; set; }

EmitCamelCaseNames​

Emitting camelCase for property names

View Source​
Declaration
[Obsolete("Use TextCase = TextCase.CamelCase")]
public static bool EmitCamelCaseNames { get; set; }

EmitLowercaseUnderscoreNames​

Emitting lowercase_underscore_casing for property names

View Source​
Declaration
[Obsolete("Use TextCase = TextCase.SnakeCase")]
public static bool EmitLowercaseUnderscoreNames { get; set; }

PropertyConvention​

Define how property names are mapped during deserialization

View Source​
Declaration
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​
Declaration
public static bool ThrowOnError { get; set; }

ThrowOnDeserializationError​

View Source​
Declaration
[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​
Declaration
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​
Declaration
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​
Declaration
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​
Declaration
public static bool AppendUtcOffset { get; set; }

EscapeUnicode​

Gets or sets a value indicating if unicode symbols should be serialized as "\uXXXX".

View Source​
Declaration
public static bool EscapeUnicode { get; set; }

EscapeHtmlChars​

Gets or sets a value indicating if HTML entity chars [> < & = '] should be escaped as "\uXXXX".

View Source​
Declaration
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​
Declaration
public static DeserializationErrorDelegate OnDeserializationError { get; set; }

PreferInterfaces​

If set to true, Interface types will be preferred over concrete types when serializing.

View Source​
Declaration
public static bool PreferInterfaces { get; set; }

IncludePublicFields​

If set to true, Interface types will be preferred over concrete types when serializing.

View Source​
Declaration
public static bool IncludePublicFields { get; set; }

MaxDepth​

Sets the maximum depth to avoid circular dependencies

View Source​
Declaration
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​
Declaration
public static EmptyCtorFactoryDelegate ModelFactory { get; set; }

ExcludeTypes​

View Source​
Declaration
public static HashSet<Type> ExcludeTypes { get; set; }

ExcludeTypeNames​

View Source​
Declaration
public static HashSet<string> ExcludeTypeNames { get; set; }

IgnoreAttributesNamed​

View Source​
Declaration
public static string[] IgnoreAttributesNamed { get; set; }

AllowRuntimeTypeWithAttributesNamed​

View Source​
Declaration
public static HashSet<string> AllowRuntimeTypeWithAttributesNamed { get; set; }

AllowRuntimeTypeWithInterfacesNamed​

View Source​
Declaration
public static HashSet<string> AllowRuntimeTypeWithInterfacesNamed { get; set; }

AllowRuntimeTypeInTypes​

View Source​
Declaration
public static HashSet<string> AllowRuntimeTypeInTypes { get; set; }

AllowRuntimeTypeInTypesWithNamespaces​

View Source​
Declaration
public static HashSet<string> AllowRuntimeTypeInTypesWithNamespaces { get; set; }

AllowRuntimeType​

View Source​
Declaration
public static Func<Type, bool> AllowRuntimeType { get; set; }

Fields​

TreatValueAsRefTypes​

View Source​
Declaration
public static HashSet<Type> TreatValueAsRefTypes

Methods​

InitStatics()​

View Source​
Declaration
public static void InitStatics()

Init()​

Mark JsConfig global config as initialized and assert it's no longer mutated

View Source​
Declaration
public static void Init()

Init(Config)​

Initialize global config and assert that it's no longer mutated

View Source​
Declaration
public static void Init(Config config)
Parameters​
TypeName
ServiceStack.Text.Configconfig

BeginScope()​

View Source​
Declaration
public static JsConfigScope BeginScope()
Returns​

ServiceStack.Text.JsConfigScope

CreateScope(String, JsConfigScope)​

View Source​
Declaration
public static JsConfigScope CreateScope(string config, JsConfigScope scope = null)
Returns​

ServiceStack.Text.JsConfigScope

Parameters​
TypeName
System.Stringconfig
ServiceStack.Text.JsConfigScopescope

With(Config)​

View Source​
Declaration
public static JsConfigScope With(Config config)
Returns​

ServiceStack.Text.JsConfigScope

Parameters​
TypeName
ServiceStack.Text.Configconfig

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​
Declaration
[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​
TypeName
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.StringtypeAttr
System.StringdateTimeFormat
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.EmptyCtorFactoryDelegatemodelFactory
System.String[]excludePropertyReferences
System.Nullable<System.Boolean>useSystemParseMethods

GetConfig()​

View Source​
Declaration
public static Config GetConfig()
Returns​

ServiceStack.Text.Config

ShouldExcludePropertyType(Type)​

View Source​
Declaration
public static bool ShouldExcludePropertyType(Type propType)
Returns​

System.Boolean

Parameters​
TypeName
System.TypepropType

Reset()​

View Source​
Declaration
public static void Reset()