Skip to content

Flatten sub-columns #26

@maidmaid

Description

@maidmaid

Given the next example, the attributes field containing sub-object is json-serialized into the column.

$ cat /tmp/ha.json | jtbl
entity_id                                attributes
---------------------------------------  -----------------------------------------------------------------
update.home_assistant_supervisor_update  {'installed_version': '2026.03.1', 'latest_version': '2026.03.2'}
update.home_assistant_core_update        {'installed_version': '2026.2.1', 'latest_version': '2026.3.4'}

The output could be more readable as dedicated column per sub-object field, as mlr does.

$ cat /tmp/ha.json | mlr --ijson --opprint cat
entity_id                               attributes.installed_version attributes.latest_version
update.home_assistant_supervisor_update 2026.03.1                    2026.03.2
update.home_assistant_core_update       2026.2.1                     2026.3.4
json sample
[
  {
    "entity_id": "update.home_assistant_supervisor_update",
    "attributes": {
      "installed_version": "2026.03.1",
      "latest_version": "2026.03.2"
    }
  },
  {
    "entity_id": "update.home_assistant_core_update",
    "attributes": {
      "installed_version": "2026.2.1",
      "latest_version": "2026.3.4"
    }
  }
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions