title: Which one is lighter, JSON or BSON?
body: <p>I have written code to serialize objects to JSON and BSON. According to my output, the BSON produced is greater in size than the JSON. Is this expected?</p>
  
  <p><strong>From my code for <code>Bson.class</code></strong> (using Jackson and bson4jackson)</p>
  
  <pre><code>private ByteArrayOutputStream baos = new ByteArrayOutputStream();
  private BsonFactory fac = new BsonFactory();
  
  private ObjectMapper mapper = new ObjectMapper(fac);
  
  public Bson(Object obj) throws JsonGenerationException,
          JsonMappingException, IOException {
      mapper.writeValue(baos, obj);
  }
  
  public int size() {
      return baos.size();
  }
  
  public String toString() {
      byte[] bytes = baos.toByteArray();
      return new String(bytes);
  }
  </code></pre>
  
  <p><strong>From my <code>Json.class</code></strong></p>
  
  <pre><code>private ByteArrayOutputStream baos = new ByteArrayOutputStream();
  private ObjectMapper mapper = new ObjectMapper();
  
  public Json(Object obj) throws JsonGenerationException,
          JsonMappingException, IOException {
      mapper.writeValue(baos, obj);
  }
  </code></pre>
  
  <p>(<code>size()</code> and <code>toString()</code> as above)</p>
  
  <p>My POJOs are <code>Person.class</code> and <code>Address.class</code>.</p>
  
  <p><strong>In my main class:</strong></p>
  
  <pre><code>    Address a = new Address("Jln Koli", "90121", "Vila", "Belgium");
      Person p = new Person("Ali Bin Baba", new Date(), 90.0, 12, a);
  
      List&lt;Person&gt; persons = new LinkedList&lt;&gt;();
      persons.add(p);
      persons.add(p);
  
      Bson bson = new Bson(persons);
      Json json = new Json(persons);
      System.out.println("Bson : " + bson.size() + ", data : " + bson.toString());
      System.out.println("Json : " + json.size() + ", data : " + json.toString());
  </code></pre>
  
  <p><strong>The ouput:</strong></p>
  
  <pre><code>Bson : 301, data : -
  Json : 285, data : [{"name":"Ali Bin Baba","birthd...
  </code></pre>
  
  <p><strong>My Question:</strong></p>
  
  <ol>
  <li>Is that output true, or is my code wrong?</li>
  <li>Any suggestion to check/test, to compare the sizes of BSON and JSON?</li>
  </ol>