public static Schema Parse(string json)
{
if (string.IsNullOrEmpty(json)) throw new ArgumentNullException("json", "json cannot be null.");
return Parse(json.Trim(), new Names());
}
Schema::Parse ( string json, Names names ) : |
private GenericRecord CreateAvroRecord(string json, string avroSchema) { try { var schema = (RecordSchema)Schema.Parse(avroSchema); var jsonObject = jsonSerializer.Deserialize <JsonObject>(json); var result = (GenericRecord)GetValue(jsonObject, schema); return(result); } catch (JsonException ex) { throw new InvalidOperationException($"Failed to parse json: {json}, got {ex.Message}", ex); } }