Reputation: 70
I have a topic in Kafka which have a schema like:
Name Type
ID STRING
ORDER_STATUS INTEGER
ORDER_ITEM_JSON STRING
ORDER_ITEM_JSON is a string of items itself:
"ORDER_ITEM_JSON":"[{\"item_id\":\"943\",\"category_id_fk\":\"42\",\"item_count\":\"1\",\"item_price\":55900,\"item_price_without_discount\":55900},{\"item_id\":\"1235\",\"category_id_fk\":\"42\",\"item_count\":\"1\",\"item_price\":25500,\"item_price_without_discount\":25500},{\"item_id\":\"1250\",\"category_id_fk\":\"42\",\"item_count\":\"1\",\"item_price\":37500,\"item_price_without_discount\":37500}]"
How can I cast this string field to an array of struct in ksql?
Upvotes: 0
Views: 1130
Reputation: 191831
I think you should re-create the stream with ARRAY<STRUCT
already defined rather than cast afterwards.
Examples on dealing with nested json
Upvotes: 1