title: Mongo Java: How to serialize DBObject as JSON on file?
body: <p>I have a document in <code>MongoDB</code> as  </p>
  
  <pre><code>name: name
  date_created: date
  p_vars: {
     01: {
        a: a,
        b: b,
     }
     02: {
        a: a,
        b: b,
     }
     ....
  }
  </code></pre>
  
  <p>represented as <code>DBObject</code></p>
  
  <ul>
  <li>All <code>key</code>, <code>value</code> pairs are of type <code>String</code>  </li>
  <li>I want to serialize this document using Java, Looking at the <a href="http://api.mongodb.org/java/2.8.0/" rel="nofollow">api</a>, I did not find anything, How can I serialize a <code>DBObject</code> as <code>JSON</code> on file?</li>
  </ul>