/// <summary>
/// Writes the Field class in JSON format
/// </summary>
/// <param name="writer">JSON writer</param>
/// <param name="names">list of named schemas already written</param>
/// <param name="encspace">enclosing namespace for the field</param>
protected internal void writeJson(JsonTextWriter writer, SchemaNames names, string encspace)
{
writer.WriteStartObject();
JsonHelper.writeIfNotNullOrEmpty(writer, "name", this.Name);
JsonHelper.writeIfNotNullOrEmpty(writer, "doc", this.Documentation);
if (null != this.DefaultValue)
{
writer.WritePropertyName("default");
this.DefaultValue.WriteTo(writer, null);
}
if (null != this.Schema)
{
writer.WritePropertyName("type");
Schema.WriteJson(writer, names, encspace);
}
if (null != this.Props)
{
this.Props.WriteJson(writer);
}
if (null != aliases)
{
writer.WritePropertyName("aliases");
writer.WriteStartArray();
foreach (string name in aliases)
{
writer.WriteValue(name);
}
writer.WriteEndArray();
}
writer.WriteEndObject();
}