title: How to convert JSON to YAML using YamlDotNet
body: <p>I am trying to convert JSON to YAML using YamlDotNet. This is the code I have:</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          var json = "{\"swagger\":\"2.0\",\"info\":{\"title\":\"UberAPI\",\"description\":\"MoveyourappforwardwiththeUberAPI\",\"version\":\"1.0.0\"},\"host\":\"api.uber.com\",\"schemes\":[\"https\"],\"basePath\":\"/v1\",\"produces\":[\"application/json\"]}";
          var swaggerDocument = JsonConvert.DeserializeObject(json);
  
          var serializer = new YamlDotNet.Serialization.Serializer();
  
          using (var writer = new StringWriter())
          {
              serializer.Serialize(writer, swaggerDocument);
              var yaml = writer.ToString();
              Console.WriteLine(yaml);
          }
      }
  }
  </code></pre>
  
  <p>This is the JSON I provide:</p>
  
  <pre><code>{
     "swagger":"2.0",
     "info":{
        "title":"UberAPI",
        "description":"MoveyourappforwardwiththeUberAPI",
        "version":"1.0.0"
     },
     "host":"api.uber.com",
     "schemes":[
        "https"
     ],
     "basePath":"/v1",
     "produces":[
        "application/json"
     ]
  }
  </code></pre>
  
  <p>This is the YAML I expect:</p>
  
  <pre><code>swagger: '2.0'
  info:
    title: UberAPI
    description: MoveyourappforwardwiththeUberAPI
    version: 1.0.0
  host: api.uber.com
  schemes:
    - https
  basePath: /v1
  produces:
    - application/json
  </code></pre>
  
  <p>However, this is the output I get:</p>
  
  <pre><code>swagger: []
  info:
    title: []
    description: []
    version: []
  host: []
  schemes:
  - []
  basePath: []
  produces:
  - []
  </code></pre>
  
  <p>I don't have a clue why all properties are empty arrays.</p>
  
  <p>I also tried typed deserialization and serialization like this:</p>
  
  <pre><code>var specification = JsonConvert.DeserializeObject&lt;SwaggerDocument&gt;(json);
  ...
  serializer.Serialize(writer, swaggerDocument, typeof(SwaggerDocument));
  </code></pre>
  
  <p>But that produces</p>
  
  <pre><code>{}
  </code></pre>
  
  <p>Any help is much appreciated.</p>