/// <summary> /// Creates a JSON payload based on the passed <see cref="Dictionary{string, object}"/> of claims. /// </summary> /// <param name="claims"> /// The <see cref="Dictionary{string, object}"/> of claims which describe the payload to create.</param> /// <returns>A JSON payload based on the passed <paramref name="claims"/>.</returns> public static string CreateJsonPayload(IDictionary <string, object> claims) { if (claims == null) { throw new ArgumentNullException(nameof(claims)); } var jobj = new Microsoft.IdentityModel.Json.Linq.JObject(); foreach (var claim in claims) { jobj.Add(claim.Key, JToken.FromObject(claim.Value)); } return(jobj.ToString(Formatting.None)); }