Thanks for reaching out on Microsoft Q&A!
As MuthuKumaranMurugaachari-MSFT correctly stated the default JSON deserialization used by the liquid template converts the dates to UTC, discarding the time zone, which invalidates your dates. So liquid unfortunately isn't an option.
However, you can solve this using JsonSerializerSettings in C# code. From there you can disable the DateParseHandling, which is causing your date invalidation. I've managed to achieve your desire by using the code below:
// Get response body as string
string responseBody = context.Response.Body.As<String>();
// Set json deserializer settings for date conversions
var jsonSettings = new JsonSerializerSettings();
jsonSettings.DateParseHandling = DateParseHandling.None;
// Convert response body to json using new settings
JArray originalItems = (JArray)Newtonsoft.Json.JsonConvert.DeserializeObject<JObject>(responseBody,jsonSettings)["ResultSets"]["Table1"];
// Create new empty array
JArray responseItems = new JArray();
// Loop through objects in array
foreach(JObject item in originalItems) {
// Create new object
JObject responseObject = new JObject();
// Fill new object with original data
responseObject["ProgramDate"] = DateTime.Parse(item["ProgramDate"].ToString()).ToString("dd-MM-yyyy");
responseObject["StartDateTime"] = item["StartDateTime"];
responseObject["EndDateTime"] = item["EndDateTime"];
responseObject["ShowTitle"] = item["ShowTitle"];
responseObject["ShowType"] = item["ShowType"];
responseObject["ShowImage"] = item["ShowImage"];
responseObject["Presenters"] = item["Presenters"];
responseObject["Description"] = item["Description"];
responseObject["ShowSectionId"] = item["ShowSectionId"];
responseObject["PresentersSectionIds"] = item["PresentersSectionIds"];
// Push new object to new array
responseItems.Add(responseObject);
}
When pasting the code above in the set-body tags using @{ } for enabling the code block (with removing the template="liquid" part) you should be able to retrieve the dates as desired. Your code will the look as follows:
When you find my answer helpful, please click "Accept answer" and upvote it.
Feel free to drop additional queries in the comments!
Kind regards,
Sonny