JsonPathConverter

Class JsonPathConverter

A JsonConverter that support json path expression in JsonProperty attributes.

Inheritance
JsonConverter
JsonPathConverter
Namespace: ETLBox.Json
Assembly: ETLBox.Json.dll
Syntax
    public class JsonPathConverter : JsonConverter
Remarks
Examples
[JsonConverter(typeof(JsonPathConverter))]
public class MySimpleRow
{
    [JsonProperty("Column1")]
    public int Col1 { get; set; }
    [JsonProperty("Column2.Value")]
    public string Col2 { get; set; }
}

Methods

CanConvert(Type)

Determines whether this instance can convert the specified object type.

Declaration
    public override bool CanConvert(Type objectType)
Parameters
TypeNameDescription
TypeobjectType

Type of the object.

Returns
TypeDescription
bool

true if this instance can convert the specified object type; otherwise, false.

Overrides

ReadJson(JsonReader, Type, object, JsonSerializer)

Reads the JSON representation of the object.

Declaration
    public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
Parameters
TypeNameDescription
JsonReaderreader

The Newtonsoft.Json.JsonReader to read from.

TypeobjectType

Type of the object.

objectexistingValue

The existing value of object being read.

JsonSerializerserializer

The calling serializer.

Returns
TypeDescription
object

The object value.

Overrides

WriteJson(JsonWriter, object, JsonSerializer)

Writes the JSON representation of the object.

Declaration
    public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
Parameters
TypeNameDescription
JsonWriterwriter

The Newtonsoft.Json.JsonWriter to write to.

objectvalue

The value.

JsonSerializerserializer

The calling serializer.

Overrides