quicktype
quicktype copied to clipboard
valid json, unable to convert to C# or nothing seems to happen, default settings
sync.txt Hi,
I have used your online conversion tool for large json files successfully with sometimes minor modifications to the converters. But the one attached does not convert. Or it seems so, because nothing happens.
Also when an enum conversion fails, I have modified the code to allow the exception pass the position where it fails :
using Newtonsoft.Json;
namespace StarTrekDataLibrary.Converters;
internal class JsonUnMarshalException : Exception { private readonly JsonReader _reader; private readonly Type _type; private readonly string? _value;
public JsonUnMarshalException(JsonReader reader,Type type,string? value)
{
_reader = reader;
_type = type;
_value = value;
}
public override string Message => $"{Description} {Location}".TrimEnd();
private string Description => $"Cannot unmarshal type {_type} with value {_value}";
private string Location => _reader is IJsonLineInfo lineInfo && lineInfo.HasLineInfo() ? $"on line:{lineInfo.LineNumber}/{lineInfo.LinePosition}" : "";
}
Feel free to use that code or something similar. When processing large files it is really useful.
Thank you.
regards, philip