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?
I think you should re-create the stream with ARRAY<STRUCT
already defined rather than cast afterwards.
Examples on dealing with nested json
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.