public static void Serialise(this List<Link> links, JsonWriter writer) { if (links.Count > 0) { writer.WriteMember("Links"); writer.WriteArray(); foreach (Link link in links) { link.Serialise(writer); } writer.WriteEndArray(); } }
public static void Serialise(this PageInfo pageInfo, JsonWriter writer) { writer.WriteMember("PageInfo"); writer.WriteObject(); writer.WriteMember("TotalCount"); writer.WriteValue(pageInfo.TotalCount.ToString()); writer.WriteMember("ItemsCount"); writer.WriteValue(pageInfo.ItemsCount.ToString()); writer.WriteMember("StartIndex"); writer.WriteValue(pageInfo.StartIndex.ToString()); writer.WriteEndObject(); }
public static void Serialise(this Link link, JsonWriter writer) { writer.WriteObject(); writer.WriteMember("rel"); writer.WriteValue(link.rel); writer.WriteMember("href"); writer.WriteValue(link.href); writer.WriteEndObject(); }