code: private byte[] getStorageJSON() {
      // 256 bytes is a good starting value, assumes default info
      final ByteArrayOutputStream output = new ByteArrayOutputStream(256);
      try {
        final JsonGenerator json = JSON.getFactory().createGenerator(output); 
        json.writeStartObject();
        json.writeStringField("tsuid", tsuid);
        json.writeStringField("displayName", display_name);
        json.writeStringField("description", description);
        json.writeStringField("notes", notes);
        json.writeNumberField("created", created);
        if (custom == null) {
          json.writeNullField("custom");
        } else {
          json.writeObjectFieldStart("custom");
          for (Map.Entry<String, String> entry : custom.entrySet()) {
            json.writeStringField(entry.getKey(), entry.getValue());
          }
          json.writeEndObject();
        }
        json.writeStringField("units", units);
        json.writeStringField("dataType", data_type);
        json.writeNumberField("retention", retention);
        json.writeNumberField("max", max);
        json.writeNumberField("min", min);
        
        json.writeEndObject(); 
        json.close();
        return output.toByteArray();
      } catch (IOException e) {
        throw new RuntimeException("Unable to serialize TSMeta", e);
      }
    }
docs: Formats the JSON output for writing to storage. It drops objects we don't
  need or want to store (such as the UIDMeta objects or the total dps) to
  save space. It also serializes in order so that we can make a proper CAS
  call. Otherwise the POJO serializer may place the fields in any order
  and CAS calls would fail all the time.
  @return A byte array to write to storage