I create a type:
$authTicketRepresentationSource = @" using System; namespace SonicFoundry.Mediasite.WebApi.Model { public class AuthorizationTicketRepresentation` {` public string TicketId { get; set; } public string Username { get; set; } public string ClientIpAddress { get; set; } public string Owner { get; set; } public DateTime CreationTime { get; set; } public DateTime ExpirationTime { get; set; } public string ResourceId { get; set; } public int MinutesToLive { get; set; } } } "@ Add-Type -TypeDefinition $authTicketRepresentationSource
I create an instance and populate it ad convert it to a JSON string:
$PostStr = [System.Text.Encoding]::UTF8.GetBytes($jsonAuthTicketRepresentation.ToString())
Then I POST this data to a URL. The problem is that the dates come out as:
{
"TicketId": "00000000-0000-0000-0000-000000000000",
"Username": "kevinb",
"ClientIpAddress": "10.0.70.154",
"Owner": "",
"CreationTime": "\/Date(1379610208888)\/",
"ExpirationTime": "\/Date(-62135575200000)\/",
"ResourceId": "773820afc2004c8dad7b8c023201dec218",
"MinutesToLive": 5
}
Rather than
{"TicketId":"00000000-0000-0000-0000-000000000000","Username":"kevinb","ClientIpAddress":"10.0.70.154","Owner":"","CreationTime":"2013-09-19T12:34:22.0987775-05:00","ExpirationTime":"0001-01-01T00:00:00","ResourceId":"599bc68366fd407a81c004e9ca91147a1d","MinutesToLive":5 }
This is causing deserialization issues with the server that this data is being posted to. How can I get the latter serialized representation of dates?
Thank you.
Kevin Burton