public string ToJSON(JSONType type) { switch (type) { case JSONType.Create: break; default: case JSONType.Update: throw new System.ApplicationException("Unsupported JSONType for BCCaptionSource"); } JSON.Builder builder = new JSON.Builder(); // only consider writing: displayName and url builder.Append("{"); builder.AppendField("displayName", displayName); if (!string.IsNullOrEmpty(url)) { builder.Append(",").AppendField("url", url); } builder.Append("}"); return(builder.ToString()); }
public string ToJSON(JSONType type) { switch (type) { case JSONType.Create: break; default: case JSONType.Update: throw new System.ApplicationException("Unsupported JSONType for BCCaptionSource"); } JSON.Builder builder = new JSON.Builder(); // only consider writing: displayName and url builder.Append("{"); builder.AppendField("displayName", displayName); if (!string.IsNullOrEmpty(url)) builder.Append(",").AppendField("url", url); builder.Append("}"); return builder.ToString(); }