Skip to content

Miller 6 and jsonlines: cut field by name #1013

Answered by johnkerl
aborruso asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @aborruso ! This is more of #310 #763 #948.

There isn't a field called info.age until the final (implicit) flatten (https://miller.readthedocs.io/en/latest/flatten-unflatten/). There's a field called info which is a map which contains a key age. The final (implicit) flatten is to prepare for CSV output.

You can work around this by doing the flatten explicitly:

$ mlr --ijsonl flatten then cut -f 'info.age' i.jsonl
info.age=49

I do intend (#948) to let non-DSL verbs like cut be able to treat things like info.age syntactically -- this needs to be coded up.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by aborruso
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants