Hi, I am learning json path and I have this json content : ``` [ "car", . . .

Flora:
hi, I am learning json path and I have this json content :

[
    "car",
    "bus",
    "truck",
    "bike"
]

when i do this (only one element is printed):

cat q13.json | jpath $[0,3]

but when I do this (2 elements are printed ):

 cat q13.json | jpath '$[0,3]'

my question, when do we need to use quotes ?

Alistair Mackay:
$ and [ are <How To Tutorials and Tech Updates – TecAdmin special characters>, so bash will process them before jpath gets them.

It is safer to quote the jsonpath expression in single quotes as in

cat q13.json | jpath '$[0,3]'

because bash will not consider the content of a single quoted string as something it should process before passing to the command being executed (in this case jpath)