File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,41 @@ of your dict keys. To do this you can use either of these options:
104
104
... jmespath.Options(dict_cls = collections.OrderedDict))
105
105
106
106
107
+ JMESPath used to support a special case `json-value ` syntax to represent a
108
+ JSON string literal, but this was being deprecated following
109
+ `JEP-12
110
+ <https://github.com/jmespath-community/jmespath.spec/blob/main/jep-012-raw-string-literals.md> `__
111
+ and its `raw-string ` literal syntax.
112
+
113
+ .. code :: python
114
+
115
+ >> > import jmespath
116
+ >> > jmespath.search(" `foo`" ' , {} )
117
+ jmespath.exceptions.LexerError: Bad jmespath expression: Bad token % s `foo` :
118
+ `foo`
119
+ ^
120
+
121
+ While JMESPath Community now fully deprecates this legacy syntax of providing
122
+ a JSON literal string with elided double quotes, you can still opt- in to parse
123
+ legacy syntax, by specifying the `` enable_legacy_literals`` flag to the
124
+ `` Options`` object .
125
+
126
+ .. code:: python
127
+
128
+ >> > import jmespath
129
+ >> > jmespath.search(" `foo`" ' ,
130
+ ... mydata,
131
+ ... jmespath.Options(enable_legacy_literals = True ))
132
+ ' foo'
133
+
134
+
135
+ >> > import jmespath
136
+ >> > parsed = jmespath.compile(" `foo`" ,
137
+ ... jmespath.Options(enable_legacy_literals = True ))
138
+ >> > parsed.search(mydata)
139
+ ' foo'
140
+
141
+
107
142
Custom Functions
108
143
~~~~~~~~~~~~~~~~
109
144
You can’t perform that action at this time.
0 commit comments