title: Postgresql - JSON
body: <p>I have a table with data. I exported this to JSON. It looks something like this:</p>
  
  <pre><code>{"@timestamp":"2015-05-18T08:57:48.646Z","ip":"0.0.0.0","extension":"php","response":"404","geo":{"coordinates":{"lat":33.48288111,"lon":-90.98561389},"src":"MD","dest":"ID","srcdest":"MD:ID"},"@tags":["success","info"]}
  </code></pre>
  
  <p>There are thousands of these lines. However, I would like to insert an incremental id that looks like this: {"index":{"_id":"1"}} before each line of the JSON. Output should look something like this:</p>
  
  <pre><code>{"index":{"_id":"1"}} 
  {"@timestamp":"2015-05-18T08:57:48.646Z","ip":"0.0.0.0","extension":"php","response":"404","geo":{"coordinates":{"lat":33.48288111,"lon":-90.98561389},"src":"MD","dest":"ID","srcdest":"MD:ID"},"@tags":["success","info"]}
  {"index":{"_id":"2"}} 
  {"@timestamp":"2015-05-18T08:57:48.646Z","ip":"0.0.0.0","extension":"php","response":"404","geo":{"coordinates":{"lat":33.48288111,"lon":-90.98561389},"src":"MD","dest":"ID","srcdest":"MD:ID"},"@tags":["success","info"]}
  </code></pre>
  
  <p>Any ideas how I can do that in JSON OR if I can export it that way in postgres?</p>