jp icon indicating copy to clipboard operation
jp copied to clipboard

Tabular output should respect missing values

Open cburgmer opened this issue 5 years ago • 0 comments

Picking values for tabular display via -t should fill columns correctly regardless of whether a property is set on an object/index is available in an array.

Example: jp --example | jp '$..[?(@.price > 10)]' | jp -t '$["title", "price"]'

Observed:

"Sword of Honour"	12.99
"The Lord of the Rings"	22.99
19.95

Expected:

"Sword of Honour"	12.99
"The Lord of the Rings"	22.99
	19.95

Possible solution: JSONPath will by default drop missing fields. Extending the query library to fill in nulls instead could fulfil this requirement.

cburgmer avatar Mar 16 '20 19:03 cburgmer