title: How do you output JSON using wp_Query in wordpress?
body: <p>Im trying to output or create json using wordpress posts data coupled with meta_key values.</p>
  
  <p>This is the code I'm using, but its forming the JSON incorrectly.</p>
  
  <pre><code>$query = new WP_Query('cat=4&amp;meta_key=meta_long');
  
  echo "var json=". json_encode($query);
  </code></pre>
  
  <p>Any ideas of how to do this?</p>