title: How to convert array of dictionary to JSON?
body: <p>I have an array of dictionaries that I'd like to convert to JSON. My object is of type <code>[[String: AnyObject]]</code> and would like to end up with a sample like this:</p>
  
  <pre><code>[
    { "abc": 123, "def": "ggg", "xyz": true },
    { "abc": 456, "def": "hhh", "xyz": false },
    { "abc": 789, "def": "jjj", "xyz": true }
  ]
  </code></pre>
  
  <p>This is what I'm trying, but the compiler is not liking my declaration:</p>
  
  <pre><code>extension Array where Element == Dictionary&lt;String, AnyObject&gt; {
      var json: String {
          do { return try? NSJSONSerialization.dataWithJSONObject(self, options: []) ?? "[]" }
          catch { return "[]" }
      }
  }
  </code></pre>
  
  <p>How can I do this?</p>