tree v2.0.4-1: -lJ flags can result in invalid JSON - missing comma before {"error":
The latest version of tree still has an issue with its JSON output:
Tested on Ubuntu 22.04.1
BASE=/home/fred
mkdir -p $BASE/t/one/two/three $BASE/t/six/seven
ln -s $BASE/t/one/two $BASE/t/six/link_to_two
cd $BASE
tree t
t
├── one
│ └── two
│ └── three
└── six
├── link_to_two -> /home/fred/t/one/two
└── seven
tree -Jl t
[
{"type":"directory","name":"t","contents":[
{"type":"directory","name":"one","contents":[
{"type":"directory","name":"two","contents":[
{"type":"directory","name":"three"}
]}
]},
{"type":"directory","name":"six","contents":[
{"type":"link","name":"link_to_two","target":"/home/fred/t/one/two"}{"error":
"recursive, not followed"}
,
{"type":"directory","name":"seven"}
]}
]}
,
{"type":"report","directories":6,"files":0}
]
Edited by simonpmind