jbvmio / kafkactl

CLI for Apache Kafka Management -
http://www.jbvm.io/kafkactl
Apache License 2.0
89 stars 9 forks source link

JSON Pretty Print #6

Closed antonkomarev closed 4 years ago

antonkomarev commented 4 years ago

It would be great to have additional flag for the kafkactl consume to display pretty printed JSON.

Raw JSON:

{"type":"UserStatusChanged","id":"e886eb90-4003-4b1f-9971-8f4bdb23dc89","timestamp":1588167444,"data":{"user":{"id":331,"status":"approved"},"from_status":"created","to_status":"approved","changed_at":"2020-04-29T13:37:18+00:00"}}

Pretty printed JSON:

{
  "type": "UserStatusChanged",
  "id": "e886eb90-4003-4b1f-9971-8f4bdb23dc89",
  "timestamp": 1588167444,
  "data": {
    "user": {
      "id": 331,
      "status": "approved"
    },
    "from_status": "created",
    "to_status": "approved",
    "changed_at": "2020-04-29T13:37:18+00:00"
  }
}

It might be useful on development phase for debugging the messages.

antonkomarev commented 4 years ago

It could be solved by using jq:

kafkactl consume my-topic | jq .