title: Serialize fixed size Map to CBOR
body: <p>I have the following JSON:</p>
  
  <pre><code>[
    {
      2: {
        "c": true
      }
    },
    {
      3: {
        "p": 10
      }
    }
  ]
  </code></pre>
  
  <p>That I would like to convert to CBOR format.
  Accordingly to cbor.me I have the following output:</p>
  
  <blockquote>
    <p>82A102A16163F5A103A161700A</p>
  </blockquote>
  
  <p>But, when using Jackson Binary CBOR Serializer, I have the following output:</p>
  
  <blockquote>
    <p>82BF02BF6163F5FFFFBF03BF61700AFFFF</p>
  </blockquote>
  
  <p>Which is not wrong, but not optimized... I have an extra 4 unnecessary bytes added to what it can really be.</p>
  
  <p>I've then tried to manually serialize the JSON but same result:</p>
  
  <pre><code>@Override
  public void serialize(Request value, JsonGenerator jgen, SerializerProvider provider)
          throws IOException, JsonProcessingException {
      jgen.writeStartArray(value.getDataList().size());
      for (Data data : value.getDataList()) {
          jgen.writeStartObject(new Map[1]);
          jgen.writeFieldId(data.getItem());
          jgen.writeStartObject();
          if (data.getObject().getC() != null) {
              jgen.writeBooleanField("c", data.getObject().getC());
          }
          if (data.getObject().getP() != null) {
              jgen.writeNumberField("p", data.getObject().getP());
          }
          jgen.writeEndObject();
          jgen.writeEndObject();
      }
      jgen.writeEndArray();
  }
  </code></pre>
  
  <p>Is this a bug with Jackson Binary format library or am I missing some configuration properties from the ObjectMapper?</p>
  
  <p><strong>EDIT</strong>: This seems to be a known issue: <a href="https://github.com/FasterXML/jackson-dataformats-binary/issues/3" rel="nofollow noreferrer">https://github.com/FasterXML/jackson-dataformats-binary/issues/3</a></p>