I'm trying to convert a yaml file to a json file with a C# application.
My application crashed on the following row
"created: !ruby/object:ActiveSupport::TimeWithZone"
How can I convert the date, because I need this part: "2016-10-14 04:56:51.057147000 Z"
The yaml:
- id: 1
created: !ruby/object:ActiveSupport::TimeWithZone
utc: &4 2016-10-14 04:56:51.057147000 Z
zone: *2
time: *4
Code:
using System.IO;
using System;
using YamlDotNet.Serialization;
public class Program
{
public static void Main()
{
var r = new StringReader(@"
- id: 1
created: !ruby/object:ActiveSupport::TimeWithZone
utc: &4 2016-10-14 04:56:51.057147000 Z
zone: *2
time: *4
");
var deserializer = new Deserializer();
var yamlObject = deserializer.Deserialize(r);
var serializer = new Serializer(SerializationOptions.JsonCompatible);
serializer.Serialize(Console.Out, yamlObject);
}
}