You are currently viewing Help with parsing json

Help with parsing json

Working on a project in spring-boot with Kotlin. I need to parse the value in “payload.after” to a Kotlin object. How can I achieve that?

https://preview.redd.it/7eh8lm8odta81.png?width=653&format=png&auto=webp&s=4535ce4332757586bd64f14afc0ab9d92fd5abd8

{"schema":{"type":"struct","fields":[{"type":"struct","fields":[{"type":"int64","optional":false,"field":"id"},{"type":"int64","optional":false,"field":"trigger_trade_order_id"},{"type":"array","items":{"type":"int64","optional":true},"optional":false,"field":"matching_trade_order_ids"},{"type":"string","optional":false,"name":"io.debezium.time.ZonedTimestamp","version":1,"field":"created_at"}],"optional":true,"name":"exchangedb.public.pending_trades.Value","field":"before"},{"type":"struct","fields":[{"type":"int64","optional":false,"field":"id"},{"type":"int64","optional":false,"field":"trigger_trade_order_id"},{"type":"array","items":{"type":"int64","optional":true},"optional":false,"field":"matching_trade_order_ids"},{"type":"string","optional":false,"name":"io.debezium.time.ZonedTimestamp","version":1,"field":"created_at"}],"optional":true,"name":"exchangedb.public.pending_trades.Value","field":"after"},{"type":"struct","fields":[{"type":"string","optional":false,"field":"version"},{"type":"string","optional":false,"field":"connector"},{"type":"string","optional":false,"field":"name"},{"type":"int64","optional":false,"field":"ts_ms"},{"type":"string","optional":true,"name":"io.debezium.data.Enum","version":1,"parameters":{"allowed":"true,last,false,incremental"},"default":"false","field":"snapshot"},{"type":"string","optional":false,"field":"db"},{"type":"string","optional":true,"field":"sequence"},{"type":"string","optional":false,"field":"schema"},{"type":"string","optional":false,"field":"table"},{"type":"int64","optional":true,"field":"txId"},{"type":"int64","optional":true,"field":"lsn"},{"type":"int64","optional":true,"field":"xmin"}],"optional":false,"name":"io.debezium.connector.postgresql.Source","field":"source"},{"type":"string","optional":false,"field":"op"},{"type":"int64","optional":true,"field":"ts_ms"},{"type":"struct","fields":[{"type":"string","optional":false,"field":"id"},{"type":"int64","optional":false,"field":"total_order"},{"type":"int64","optional":false,"field":"data_collection_order"}],"optional":true,"field":"transaction"}],"optional":false,"name":"exchangedb.public.pending_trades.Envelope"},"payload":{"before":null,"after":{"id":12,"trigger_trade_order_id":28,"matching_trade_order_ids":[29],"created_at":"2022-01-10T07:01:57.697168Z"},"source":{"version":"1.8.0.Final","connector":"postgresql","name":"exchangedb","ts_ms":1641798117697,"snapshot":"false","db":"postgres","sequence":"["24856144","24856200"]","schema":"public","table":"pending_trades","txId":599,"lsn":24856200,"xmin":null},"op":"c","ts_ms":1641798117948,"transaction":null}} 

submitted by /u/adarshbalu
[link] [comments]