Consider explaining projections in more detail #95
Replies: 2 comments 1 reply
-
I think I have a mental model that works for explaining what are projections and how they work. Imagine a JMESPath expression as a pipeline, like a series of more focused expressions that process input and produce output.
I define a "projection" as being a list of JSON tokens (very similar to a JSON array). The only way to fold a projection back to a regular JSON array is to either use a So if you use a Consider the following input JSON document: [
{ "name": "jack" },
{ "name": "john" }
] Consider the following two very similar expressions:
Using
|
Beta Was this translation helpful? Give feedback.
-
Projections are one of the difficult concepts to grasp for newcomers and it can bite experienced users as well.
It needs better explanation in the documentation.
Also, the spec does not list all the projections. It should clearly indicate that projections are:
list-wildcard-expression
i.e*
hash-wildcard-expression
i.e[*]
flatten-expression
i.e[]
slice-expression
i.e[0:1:1]
In contrast, an
index
ie[0]
is not a projection.Beta Was this translation helpful? Give feedback.
All reactions