@Test
public void structToJson() {

    Schema schema = SchemaBuilder.struct().field("field1", Schema.BOOLEAN_SCHEMA).field("field2", Schema.STRING_SCHEMA).field("field3", Schema.STRING_SCHEMA).field("field4", Schema.BOOLEAN_SCHEMA).build();
    Struct input = new Struct(schema).put("field1", true).put("field2", "string2").put("field3", "string3").put("field4", false);
    JsonNode converted = parse(converter.fromConnectData(TOPIC, schema, input));
    validateEnvelope(converted);
    assertEquals(parse("{ \"type\": \"struct\", \"optional\": false, \"fields\": [{ \"field\": \"field1\", \"type\": \"boolean\", \"optional\": false }, { \"field\": \"field2\", \"type\": \"string\", \"optional\": false }, { \"field\": \"field3\", \"type\": \"string\", \"optional\": false }, { \"field\": \"field4\", \"type\": \"boolean\", \"optional\": false }] }"),
            converted.get(JsonSchema.ENVELOPE_SCHEMA_FIELD_NAME));
    assertEquals(JsonNodeFactory.instance.objectNode()
                    .put("field1", true)
                    .put("field2", "string2")
                    .put("field3", "string3")
                    .put("field4", false),
            converted.get(JsonSchema.ENVELOPE_PAYLOAD_FIELD_NAME));
}