public static List <Product> listFromJson(string json) { var lp = new List <Product> (); JsonObject rep = (JsonObject)JsonObject.Parse(json); if (rep.ContainsKey("results")) { foreach (JsonObject jo in rep["results"]) { try{ lp.Add(Product.oneFromJson(jo)); } catch (Exception) { } } } else { try{ lp.Add(Product.oneFromJson(rep)); } catch (Exception) { } } return(lp); }
public static Product oneFromJson(string json) { return(Product.oneFromJson((JsonObject)JsonObject.Parse(json))); }