public static RFResult dumpRestRaw(Config cfg, string section, Func <Config, string, RFResult> callback = null, string[] cols = null) { var rfr = new RFResult(); DataContractJsonSerializerSettings settings = new DataContractJsonSerializerSettings { UseSimpleDictionaryFormat = true }; var serializer = new DataContractJsonSerializer(typeof(GenericAnswer), settings); string urn = $"https://{cfg.Host}/mgmt/tm/{section}"; Stream strm = null; var client = new RESTClient(cfg); RESTClient.request(client.GetClient(), urn, "GET", "", (v) => { strm = v; return(true); }).Wait(); if (strm != null) { try { JObject resp = JObject.Parse((new StreamReader(strm)).ReadToEnd()); Console.WriteLine("collection: {0}", resp["kind"]); var globdict = new List <string>(); var list = new List <RFRow>(); var banned = new List <string>(); banned.Add("selfLink"); banned.Add("kind"); banned.Add("fullPath"); banned.Add("apiAnonymous"); if (resp["items"] != null) { foreach (JToken tk in resp["items"].Children()) { var dict = new Dictionary <string, string>(); var references = new Dictionary <string, string>(); //Console.WriteLine(" {0}", tk["name"]); foreach (JToken ce in tk.Children()) { if (ce.Type == JTokenType.Property) { JProperty pr = ce.ToObject <JProperty>(); //Console.WriteLine(" tp: {3} {0} {1} {2}", ce.Type, pr.Name, pr.Value, pr.Value.HasValues); if (!globdict.Contains(pr.Name)) { if (pr.Name.EndsWith("Reference")) { references.Add(pr.Name, pr.Value["link"].ToString()); } if (!banned.Contains(pr.Name) && !pr.Name.EndsWith("Reference")) { globdict.Add(pr.Name); } } if (pr.Value.HasValues) { if (pr.Value.Type == JTokenType.Array) { JArray ja = pr.Value.ToObject <JArray>(); dict.Add(pr.Name, ja.ToString()); } else { dict.Add(pr.Name, pr.Value.ToString()); } } else { if (pr.Value.Type == JTokenType.String) { dict.Add(pr.Name, (string)pr.Value); } else { dict.Add(pr.Name, pr.Value.ToString()); } } } } var crow = new RFRow(dict); if (cols != null) { foreach (var colref in cols) { if (references[colref] != null) { crow.extra = callback(cfg, references[colref]); } } } list.Add(crow); } rfr.header = globdict; rfr.nodes = list; } } catch (Exception ex) { Console.WriteLine("-- dumpRestRaw: {0}", ex.Message); } } return(rfr); }