Avro.Schema.Parse C# (CSharp) Method

Parse() public static method

public static Parse ( string json ) : Schema
json string
return Schema
        public static Schema Parse(string json)
        {
            if (string.IsNullOrEmpty(json)) throw new ArgumentNullException("json", "json cannot be null.");
            return Parse(json.Trim(), new Names());
        }

Same methods

Schema::Parse ( string json, Names names ) : Schema

Usage Example

Ejemplo n.º 1
0
        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);
            }
        }
All Usage Examples Of Avro.Schema::Parse