aliadnani edited a comment on issue #398: URL: https://github.com/apache/camel-kafka-connector/issues/398#issuecomment-682320665
Thank you! It works! I was wrong that the `JsonSchemaConverter` deserializes the record into a JsonNode object, I found out its actually a [Kafka Connect Struct Object](https://kafka.apache.org/11/javadoc/org/apache/kafka/connect/data/Struct.html). Anyways, I installed a [transform library](https://github.com/jcustenborder/kafka-connect-transform-common/tree/master/src) and used the [ToJSON SMT](https://github.com/jcustenborder/kafka-connect-transform-common#tojson) to form a JSON string from the Struct before outputting to websocket. My CURL request looks like this now: ``` curl -X POST -H "Content-Type: application/json" \ --data '{ "name": "camel-sink3", "config": { "topics": "xxx", "value.converter": "io.confluent.connect.json.JsonSchemaConverter", "value.converter.schema.registry.url": "http:/xxx-cp-schema-registry:8081", "key.converter": "org.apache.kafka.connect.storage.StringConverter", "connector.class": "org.apache.camel.kafkaconnector.websocket.CamelWebsocketSinkConnector", "camel.sink.path.host": "0.0.0.0", "camel.sink.path.port":"8084", "camel.component.websocket.host":"0.0.0.0", "camel.component.websocket.port": "8084", "camel.sink.path.resourceUri": "kstreams-windows-average", "camel.component.websocket.minThreads": "3", "camel.sink.endpoint.sendToAll": "true", "transforms": "toJson", "transforms.toJson.type": "com.github.jcustenborder.kafka.connect.transform.common.ToJSON$Value", "transforms.toJson.schemas.enable": "false" } }' http://xxx:8083/connectors ``` And now the output is a proper JSON: `{"unit":"C","utc":1588264680439,"name":"temperature","value":422.0}` I was thinking maybe this should be the default behavior for Sink Connectors dealing consuming non-string data (JSON in my case) and don't have to send data in a specific format. To me it makes more sense that non-string data (JSON, Avro) parsed by their converters to a Struct Object is sent to a websocket (or any other sink) as JSON rather than string-ed struct: `Struct{key1=val1,key2=val2}` Anyways, thanks again for the help! ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org