Let's say I use the command find "$HOME" -maxdepth 1 -type d and I get the following result:
/home/user/folder1
/home/user/folder2
/home/user/folder3
/home/user/folder4
I'd like to use jq on a pipe and create different JSON lines as the following result:
{ "path": "/home/user/folder1", "type":"directory"}
{ "path": "/home/user/folder2", "type":"directory"}
{ "path": "/home/user/folder3", "type":"directory"}
{ "path": "/home/user/folder4", "type":"directory"}
I expected to solve it with jq to avoid putting this list of folders inside an array and creating them one by one in a loop. In pseudo-code the idea would be:
find "$HOME" -maxdepth 1 -type d | jq '.logic-to-create-json-strings'
Is it possible to do with jq?