} // End Function GetValue private static System.Collections.Generic.Dictionary <string, object> ProcessObject(Newtonsoft.Json.Linq.JToken json) { if (json == null) { throw new System.ArgumentNullException(nameof(json)); } System.Collections.Generic.Dictionary <string, object> lss = new System.Collections.Generic.Dictionary <string, object>(System.StringComparer.OrdinalIgnoreCase); Newtonsoft.Json.Linq.JObject jo = (Newtonsoft.Json.Linq.JObject)json; foreach (System.Collections.Generic.KeyValuePair <string, Newtonsoft.Json.Linq.JToken> kvp in jo) { string name = kvp.Key; object value = GetValue(kvp.Value); System.Console.WriteLine(value); if (ParameterNameHelper.IsInvalid(name)) { continue; } lss.Add(name, value); } return(lss); } // ProcessObject
GetParameters(Microsoft.AspNetCore.Http.HttpContext context) { // Note: // Reverse sequence: last inserted item is prefered item... // Missing server-variables // Missing cookies System.Collections.Generic.Dictionary <string, object> dict = null; //foreach (System.Collections.Generic.KeyValuePair<string // , Microsoft.Extensions.Primitives.StringValues> kvp in context.Request.Headers) //{ // dict[kvp.Key] = kvp.Value; //} // Next kvp System.Collections.Generic.List <System.Collections.Generic.Dictionary <string, object> > lss = GetJsonObjectAsParameterList(context); if (lss != null && lss.Count == 1) { dict = lss[0]; } else { dict = new System.Collections.Generic.Dictionary <string, object> (System.StringComparer.InvariantCultureIgnoreCase); } if (context.Request.HasFormContentType) { foreach (System.Collections.Generic.KeyValuePair <string , Microsoft.Extensions.Primitives.StringValues> kvp in context.Request.Form) { if (ParameterNameHelper.IsInvalid(kvp.Key)) { continue; } dict[kvp.Key] = System.Convert.ToString(kvp.Value); } // Next kvp } // End if (context.Request.HasFormContentType) if (context.Request.QueryString.HasValue) { foreach (System.Collections.Generic.KeyValuePair <string , Microsoft.Extensions.Primitives.StringValues> kvp in context.Request.Query) { if (ParameterNameHelper.IsInvalid(kvp.Key)) { continue; } dict[kvp.Key] = System.Convert.ToString(kvp.Value); } // Next kvp } // End if (context.Request.QueryString.HasValue) return(dict); }