Kafka Connector > Mappings for Kafka > Sample schema files
  

Sample schema files

The Kafka sources and targets in a mapping read or write data in JSON or Avro format. The following examples contain samples for each schema format.

Sample JSON File

When you use a Kafka source or target in a mapping, specify the format in which Kafka Connector reads or writes data. When you specify JSON format, provide a sample JSON file. The sample file contains dummy JSON data and is used to generate the schema.
The following is a sample JSON file:
{"id" : 1, "name" : "sample"}
Note: You must define the JSON sample in a single line. Otherwise, the mapping fails.

Sample Avro Schema

When you use a Kafka source or target in a mapping, specify the format in which Kafka Connector reads or writes data. When you specify Avro format, provide a sample Avro file.
The following schema is a sample Avro schema:
{
"type" : "record",
"name" : "Customer",
"fields" : [ {
"name" : "c_custkey",
"type" : [ "int", "null" ],
"default" : null
}, {
"name" : "c_name",
"type" : [ "string", "null" ],
"default" : null
}, {
"name" : "c_address",
"type" : [ "string", "null" ],
"default" : null
}]
}