code: private JsonObject parse(JsonObject record, JsonSchema schema)
        throws DataConversionException {
        JsonObject output = new JsonObject();
        for (int i = 0; i < schema.fieldsCount(); i++) {
          JsonSchema schemaElement = schema.getFieldSchemaAt(i);
          String columnKey = schemaElement.getColumnName();
          JsonElement parsed;
          if (!record.has(columnKey)) {
            output.add(columnKey, JsonNull.INSTANCE);
            continue;
          }
  
          JsonElement columnValue = record.get(columnKey);
          switch (schemaElement.getType()) {
            case UNION:
              parsed = parseUnionType(schemaElement, columnValue);
              break;
            case ENUM:
              parsed = parseEnumType(schemaElement, columnValue);
              break;
            default:
              if (columnValue.isJsonArray()) {
                parsed = parseJsonArrayType(schemaElement, columnValue);
              } else if (columnValue.isJsonObject()) {
                parsed = parseJsonObjectType(schemaElement, columnValue);
              } else {
                parsed = parsePrimitiveType(schemaElement, columnValue);
              }
          }
          output.add(columnKey, parsed);
        }
        return output;
    }
docs: Parses a provided JsonObject input using the provided JsonArray schema into
  a JsonObject.
  @param record
  @param schema
  @return
  @throws DataConversionException