XmlNodeConverter Class

Namespace: Stimulsoft.Base.Json.Converters

Converts XML to and from JSON.

Inheritance

Inherits from: JsonConverter

Properties

Property Type Description
DeserializeRootElementName string Gets or sets the name of the root element to insert when deserializing to XML if the JSON structure has produces multiple root elements.
OmitRootObject bool Gets or sets a value indicating whether to write the root JSON object.
WriteArrayAttribute bool Gets or sets a flag to indicate whether to write the Json.NET array attribute. This attribute helps preserve arrays when converting the written XML back to JSON.

Methods

Method Returns Description
CanConvert bool Determines whether this instance can convert the specified value type.
ReadJson object Reads the JSON representation of the object.
WriteJson void Writes the JSON representation of the object.

Method Details

CanConvert

CanConvert(valueType: Type): bool

Determines whether this instance can convert the specified value type.

Parameters

  • valueType (Type) — Type of the value.

Returns bool — true if this instance can convert the specified value type; otherwise, false.


ReadJson

ReadJson(reader: JsonReader, objectType: Type, existingValue: object, serializer: JsonSerializer): object

Reads the JSON representation of the object.

Parameters

  • reader (JsonReader) — The JsonReader to read from.
  • objectType (Type) — Type of the object.
  • existingValue (object) — The existing value of object being read.
  • serializer (JsonSerializer) — The calling serializer.

Returns object — The object value.


WriteJson

WriteJson(writer: JsonWriter, value: object, serializer: JsonSerializer): void

Writes the JSON representation of the object.

Parameters

  • writer (JsonWriter) — The JsonWriter to write to.
  • value (object) — The value.
  • serializer (JsonSerializer) — The calling serializer.