title: How i generate json schema from mongodb result in java?
body: <p>I have a simple mongodb query and need the json schema of the result.</p>
  
  <pre><code>    MongoClientURI uri = new MongoClientURI("mongodb://localhost:27017");
      String database = "test_m0001";
  
      MongoClient mongo = new MongoClient(uri);
      DB db = mongo.getDB(database);
      DBCollection coll = db.getCollection(collectionName);
  
      try (DBCursor cursor = coll.find().limit(100)) {
          while (cursor.hasNext()) {
              DBObject document = cursor.next();
              System.out.println(document);
              // --&gt; generate json schema for document
          }
      }
      // --&gt; merge json schema for all documents from query
  </code></pre>
  
  <p>What is the way to generate json schema in java? I looked into the Jackson JSON Schema Modul, but i don't find any answer. I don't have a model class, only the unknown structured documents in the mongodb collection.</p>