Skip to content

Add --json output format #1

@19bk

Description

@19bk

Add a --json flag to the read, dump, and scan commands that outputs results as JSON instead of Rich tables.

This would allow piping into jq or other tools:

modbus read 192.168.1.10 40001 -c 5 --json | jq '.registers[].value'

Suggested JSON schema for read:

{
  "host": "192.168.1.10",
  "type": "holding",
  "slave": 1,
  "registers": [
    {"address": 40001, "raw": 237, "value": "237"}
  ]
}

Good first contribution. The logic is in modbus_cli/cli.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions