Map<String, Object> m = new LinkedHashMap<String, Object>();
m.put("data", data);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectMapper om = new ObjectMapper(new BsonFactory());
om.registerModule(new BsonModule());
om.writeValue(baos, m);
byte[] r = baos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(r);