cbornet opened a new issue, #24129: URL: https://github.com/apache/pulsar/issues/24129
### Search before asking - [x] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar. ### Read release policy - [x] I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker. ### Version HEAD ### Minimal reproduce step Run the following test ```java @Test public void testSerializeRecordToJsonExpandingValue() throws Exception { SchemaType schemaType = SchemaType.AVRO; RecordSchemaBuilder valueSchemaBuilder = org.apache.pulsar.client.api.schema.SchemaBuilder.record("value"); valueSchemaBuilder.field("a").type(SchemaType.BYTES).optional().defaultValue(null); GenericSchema<GenericRecord> valueSchema = Schema.generic(valueSchemaBuilder.build(schemaType)); GenericRecord valueGenericRecord = valueSchema.newRecordBuilder() .set("a", "10".getBytes(StandardCharsets.UTF_8)) .build(); Record<GenericObject> genericObjectRecord = new Record<>() { @Override public org.apache.pulsar.client.api.Schema getSchema() { return valueSchema; } @Override public GenericObject getValue() { return valueGenericRecord; } }; ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL); String json = Utils.serializeRecordToJsonExpandingValue(objectMapper, genericObjectRecord, true); assertEquals(json, "{\"payload.a\":\"MTA=\"}"); } ``` ### What did you expect to see? The test should pass. ### What did you see instead? The test fails because `payload.a` is `null`. ```sh java.lang.AssertionError: Expected :{"payload.a":"MTA="} Actual :{"payload.a":null} ``` ### Anything else? The problem is in the flattening library `json-flattener` which doesn't handle Jackson's BinaryNode. In `JsonJacksonValue`, `isString` should also return `true` when the underlying `JsonNode` `isBinary` is `true`. ### Are you willing to submit a PR? - [x] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org