public JsonValue ToJson(IJsonContext context) { var dict = new JsonDictionary(); dict["UserName"] = context.ToJson(UserName); dict["ValidTo"] = context.ToJson(ValidTo.ToUnixTime()); dict["ApiToken"] = context.ToJson(ApiToken); return dict; }
public JsonValue ToJson(IJsonContext context) { var dict = new JsonDictionary(); dict.Set("id", SetID); dict.Set("url", Uri.ToString()); dict.Set("title", Title); dict.Set("created_by", Author); if (Description != null) { dict.Set("description", Description); } dict.Set("term_count", TermCount); dict.Set("created_date", Created.ToUnixTime()); dict.Set("modified_date", Modified.ToUnixTime()); dict["subjects"] = context.ToJson(Subjects); dict.Set("visibility", Visibility.ToApiString()); dict.Set("editable", EditPermissions.ToApiString()); dict.Set("has_access", HasAccess); dict.Set("has_discussion", HasDiscussion); dict.Set("lang_terms", TermLanguageCode); dict.Set("lang_definitions", DefinitionLanguageCode); if (Terms != null) { dict["terms"] = context.ToJson(Terms); } return(dict); }
public JsonValue ToJson(IJsonContext context) { var dict = new JsonDictionary(); dict["UserName"] = context.ToJson(UserName); dict["ValidTo"] = context.ToJson(ValidTo.ToUnixTime()); dict["ApiToken"] = context.ToJson(ApiToken); return(dict); }
JsonValue IJsonConvertible.ToJson(IJsonContext context) { var dict = new JsonDictionary(); dict.Items.Add("Entries", context.ToJson(Entries)); dict.Items.Add("MaximumSize", context.ToJson(MaximumSize)); return(dict); }
public JsonValue ToJson(IJsonContext ctx) { return(new JsonDictionary() .Set("items", ctx.ToJson(items)) .Set("nextItems", ctx.ToJson(nextItems)) .Set("failed", new JsonBool(failed)) .Set("currentItem", ctx.ToJson(CurrentItem)) .Set("currentIndex", new JsonNumber(CurrentIndex)) .Set("itemCount", new JsonNumber(ItemCount)) .Set("score", new JsonNumber(Score)) .Set("round", new JsonNumber(Round)) .Set("lastRoundInfo", ctx.ToJson(LastRoundInfo)) .Set("allRounds", ctx.ToJson(AllRounds.ToList())) .Set("title", new JsonString(Title)) .Set("maxItemCount", new JsonNumber(maxItemCount))); }
public JsonValue ToJson(IJsonContext context) { var dict = new JsonDictionary(); dict.Set("id", SetID); dict.Set("url", Uri.ToString()); dict.Set("title", Title); dict.Set("created_by", Author); if (Description != null) dict.Set("description",Description); dict.Set("term_count", TermCount); dict.Set("created_date", Created.ToUnixTime()); dict.Set("modified_date", Modified.ToUnixTime()); dict["subjects"] = context.ToJson(Subjects); dict.Set("visibility", Visibility.ToApiString()); dict.Set("editable", EditPermissions.ToApiString()); dict.Set("has_access", HasAccess); dict.Set("has_discussion", HasDiscussion); dict.Set("lang_terms", TermLanguageCode); dict.Set("lang_definitions", DefinitionLanguageCode); if (Terms != null) dict["terms"] = context.ToJson(Terms); return dict; }
public JsonValue ToJson(object value, IJsonContext context) { var list = value as List <T>; if (list == null) { throw new JsonConvertException("Value was not a List<" + typeof(T) + ">"); } var array = new JsonArray(); foreach (var item in list) { array.Items.Add(context.ToJson(item)); } return(array); }
public JsonValue ToJson(IJsonContext ctx) { return new JsonDictionary() .Set("items", ctx.ToJson(items)) .Set("nextItems", ctx.ToJson(nextItems)) .Set("failed", new JsonBool(failed)) .Set("currentItem", ctx.ToJson(CurrentItem)) .Set("currentIndex", new JsonNumber(CurrentIndex)) .Set("itemCount", new JsonNumber(ItemCount)) .Set("score", new JsonNumber(Score)) .Set("round", new JsonNumber(Round)) .Set("lastRoundInfo", ctx.ToJson(LastRoundInfo)) .Set("allRounds", ctx.ToJson(AllRounds.ToList())) .Set("title", new JsonString(Title)) .Set("maxItemCount", new JsonNumber(maxItemCount)); }