Interface IJSONWritable
Denotes a CLR type-safe entity (class or struct) that can directly write itself as JSON content string. This mechanism bypasses all of the reflection/dynamic code. This approach may be far more performant for some classes that need to serialize their state/data in JSON format, than relying on general-purpose JSON serializer that can serialize any type but is slower
Namespace: Azos.Serialization.JSON
Assembly: Azos.dll
Syntax
public interface IJSONWritable
Methods
WriteAsJSON(TextWriter, Int32, JSONWritingOptions)
Writes entitie's data/state as JSON string
Declaration
void WriteAsJSON(TextWriter wri, int nestingLevel, JSONWritingOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.IO.TextWriter | wri | TextWriter to write JSON content into |
System.Int32 | nestingLevel | A level of nesting that this instance is at, relative to the graph root. Implementations may elect to use this parameter to control indenting or ignore it |
JSONWritingOptions | options | Writing options, such as indenting. Implementations may elect to use this parameter to control text output or ignore it |