title: Layout NLog properties as JSON?
body: <p>I am trying to figure out how to log all the properties in a <code>LogEventInfo</code> object to a JSON-formatted string.  Per the <a href="https://github.com/NLog/NLog/issues/723" rel="noreferrer">issue on github</a>, I tried to do something like this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;target xsi:type="ColoredConsole" name="coloredConsole"&gt;
    &lt;layout xsi:type="JsonLayout"&gt;
      &lt;attribute name="timestamp" layout="${longdate}"/&gt;
      &lt;attribute name="level" layout="${level:uppercase=true}"/&gt;
      &lt;attribute name="exception" layout="${onexception:${exception:format=tostring}}" /&gt;
      &lt;attribute name="properties" encode="false"&gt;
        &lt;layout type="JsonLayout"&gt;
          &lt;attribute name="properties" layout="${all-event-properties}" /&gt;
        &lt;/layout&gt;
      &lt;/attribute&gt;
    &lt;/layout&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>... but unfortunately, my properties contain complex objects (I have two properties with the names of "properties" and "tags", where "properties" is a <code>IDictionary&lt;string, object&gt;</code> and "tags" is an <code>IList&lt;string&gt;</code> in the <code>LogEventInfo.Properties</code> property) that simply do not serialize.  I end up with something resembling this:</p>
  
  <pre class="lang-json prettyprint-override"><code>{ "timestamp": "2017-05-18 08:41:28.7730", "level": "INFO", "properties": { "properties": "properties=System.Collections.Generic.Dictionary`2[System.String,System.Object], tags=System.Collections.Generic.List`1[System.String]" } }
  </code></pre>
  
  <p>I was expecting (and hoping for) a serialized JSON dictionary that would give me the context of the log message, but clearly that is not what I am getting.</p>
  
  <p>How can I properly serialize the properties in my <code>LogEventInfo</code> object?</p>