How to convert nested Json Array to kafka connect struct and schema through SMT

HI there:
We got some input data which are nested Json Array. We failed to convert it to kafka connect schema and struct. Is there any easy way to do that? We try JSon to schema SMT and kafka json convert.
Json convert
SMT

Both of them support nested json object other than Array. Hope anyone can give us a hand. Thanks a lot
The nested Json we have look like that

{
"id": "0001",
"batters":
{
"batter":
[
{ "id": "1001", "type": "Regular" }
]
}
}

the schema we use for FromJson SMT:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "batters": {
      "type": "object",
      "properties": {
        "batter": {
          "type": "array",
          "items": [
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "type"
              ]
            }
          ]
        }
      },
      "required": [
        "batter"
      ]
    }
  },
  "required": [
    "id",
    "batters"
  ]
}

Try using KSQL. You can query structured data and transform it accordingly

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.