This is part of my custom json converter:
 public class ExpandoConverter : JsonConverter
{
    public override bool CanConvert(Type objectType)
    {
        return typeof(Expando).IsAssignableFrom(objectType);
    }
    public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
    {
        if (reader.TokenType == JsonToken.Null)
            return null;
        /// How can I get all json string from reader at this point like that:
        /// string js= reader.ReadStringToEnd();
I dont want to get all serialization string, I need data of converter's targeting.
Ex:
{.......................{"Id":3,"Name":"MyExpando1"}}
What I managed with this is using JObject and loading the reader into the JObject like so:
    public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
    {
        JObject jObject = JObject.Load(reader);
        var dictionary = serializer.Deserialize<Dictionary<string, object>>(jObject);
    }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With