Skip to content

How to dump paths to leafs and the leaf values? #78

@tischwa

Description

@tischwa

Hi,

I'm trying to achieve the following: Dump paths to leafs and the leaf values.

Example:

$ echo '{"a":{"b":1,"c":2},"d":["x",1]}' | jq '<what to write here?>'
a.b = 1
a.c = 2
d.0 = x
d.1 = 1

I think using the recurse-function it should be possible somehow, any ideas?

It is a bit similar to what

https://github.com/wuyongzheng/json-liner

does, but the output format is more or less fixed there. And using jq I could apply all of jq's filtering possibilities.

Regards,
Tilo

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions