so now I'm trying to figure out how to make sure I can pass two json objects of which I not know their data into the request body. My parameters on the request body should be
(JSON)main_object
(JSON)main_object
,
(JSON)secondary_object
(JSON)secondary_object
,
(anything, so JToken??)matching_property
(anything, so JToken??)matching_property
,
(string[])merge_properties
(string[])merge_properties
Does this mean I should be using
JToken
JToken
? currently I'm trying this:
[FunctionName("MergeSingleAsync")]public static async Task<IActionResult> RunAsync([HttpTrigger(AuthorizationLevel.Function, "post", Route = null)]HttpRequest req, ILogger log){ string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); Inputs data = JsonConvert.DeserializeObject<Inputs>(requestBody); // ...}class Inputs{ [JsonProperty("main_object")] public string MainObject {get;set;} // Should be JToken?? [JsonProperty("secondary_object")] public string SecondaryObject {get;set;} // Should be JToken?? [JsonProperty("matching_property")] public JToken MatchingProperty {get;set;} [JsonProperty("merge_properties")] public string[] MergeProperties {get;set;}}
[FunctionName("MergeSingleAsync")]public static async Task<IActionResult> RunAsync([HttpTrigger(AuthorizationLevel.Function, "post", Route = null)]HttpRequest req, ILogger log){ string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); Inputs data = JsonConvert.DeserializeObject<Inputs>(requestBody); // ...}class Inputs{ [JsonProperty("main_object")] public string MainObject {get;set;} // Should be JToken?? [JsonProperty("secondary_object")] public string SecondaryObject {get;set;} // Should be JToken?? [JsonProperty("matching_property")] public JToken MatchingProperty {get;set;} [JsonProperty("merge_properties")] public string[] MergeProperties {get;set;}}
I would love some assistance I'm stuck at this for 2 days now