jmespath 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/jmespath/lexer.rb +11 -11
- data/lib/jmespath.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9276a9f614d19179d10e5e166950070fdbce091b7154ea2c15e700ca155ab4e
|
4
|
+
data.tar.gz: e3a122d91c10056382b50876583f550be0bf07a015c68ffaaff8cb2c3e4fcacf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46128b4ab5e58de1f2cdcb80a2b2e8e69690cce7455da154da4b4c18406e80a83de24c07339eca4cddef142afea29b74f131b48fe7292ce36131b8e2cd1cb80c
|
7
|
+
data.tar.gz: 0f44933d7fc3736bf71273736089b7c6787ce4127f96742b263822a7eb7123e9326f7a9512b408d9128bdd0fb6dcf8839ddceaf773c75f031c1c65436929ee42
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.1
|
data/lib/jmespath/lexer.rb
CHANGED
@@ -298,12 +298,12 @@ module JMESPath
|
|
298
298
|
# Certain versions of Ruby and of the pure_json gem not support loading
|
299
299
|
# scalar JSON values, such a numbers, booleans, strings, etc. These
|
300
300
|
# simple values must be first wrapped inside a JSON object before calling
|
301
|
-
# `JSON.
|
301
|
+
# `JSON.parse`.
|
302
302
|
#
|
303
303
|
# # works in most JSON versions, raises in some versions
|
304
|
-
# JSON.
|
305
|
-
# JSON.
|
306
|
-
# JSON.
|
304
|
+
# JSON.parse("true")
|
305
|
+
# JSON.parse("123")
|
306
|
+
# JSON.parse("\"abc\"")
|
307
307
|
#
|
308
308
|
# This is an known issue for:
|
309
309
|
#
|
@@ -317,12 +317,12 @@ module JMESPath
|
|
317
317
|
# causes issues in environments that cannot compile the gem. We previously
|
318
318
|
# had a direct dependency on `json_pure`, but this broke with the v2 update.
|
319
319
|
#
|
320
|
-
# This method allows us to detect how the `JSON.
|
320
|
+
# This method allows us to detect how the `JSON.parse` behaves so we know
|
321
321
|
# if we have to wrap scalar JSON values to parse them or not.
|
322
322
|
# @api private
|
323
323
|
def self.requires_wrapping?
|
324
324
|
begin
|
325
|
-
JSON.
|
325
|
+
JSON.parse('false')
|
326
326
|
rescue JSON::ParserError
|
327
327
|
true
|
328
328
|
end
|
@@ -332,12 +332,12 @@ module JMESPath
|
|
332
332
|
def parse_json(token, quoted = false)
|
333
333
|
begin
|
334
334
|
if quoted
|
335
|
-
token.value = JSON.
|
335
|
+
token.value = JSON.parse("{\"value\":#{token.value}}")['value']
|
336
336
|
else
|
337
337
|
begin
|
338
|
-
token.value = JSON.
|
338
|
+
token.value = JSON.parse("{\"value\":#{token.value}}")['value']
|
339
339
|
rescue
|
340
|
-
token.value = JSON.
|
340
|
+
token.value = JSON.parse(sprintf('{"value":"%s"}', token.value.lstrip))['value']
|
341
341
|
end
|
342
342
|
end
|
343
343
|
rescue JSON::ParserError
|
@@ -349,9 +349,9 @@ module JMESPath
|
|
349
349
|
def parse_json(token, quoted = false)
|
350
350
|
begin
|
351
351
|
if quoted
|
352
|
-
token.value = JSON.
|
352
|
+
token.value = JSON.parse(token.value)
|
353
353
|
else
|
354
|
-
token.value = JSON.
|
354
|
+
token.value = JSON.parse(token.value) rescue JSON.parse(sprintf('"%s"', token.value.lstrip))
|
355
355
|
end
|
356
356
|
rescue JSON::ParserError
|
357
357
|
token.type = T_UNKNOWN
|
data/lib/jmespath.rb
CHANGED
@@ -26,7 +26,7 @@ module JMESPath
|
|
26
26
|
data = case data
|
27
27
|
when Hash, Struct then data # check for most common case first
|
28
28
|
when Pathname then load_json(data)
|
29
|
-
when IO, StringIO then JSON.
|
29
|
+
when IO, StringIO then JSON.parse(data.read)
|
30
30
|
else data
|
31
31
|
end
|
32
32
|
Runtime.new(runtime_options).search(expression, data)
|
@@ -34,7 +34,7 @@ module JMESPath
|
|
34
34
|
|
35
35
|
# @api private
|
36
36
|
def load_json(path)
|
37
|
-
JSON.
|
37
|
+
JSON.parse(File.open(path, 'r', encoding: 'UTF-8') { |f| f.read })
|
38
38
|
end
|
39
39
|
|
40
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jmespath
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trevor Rowe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Implements JMESPath for Ruby
|
14
14
|
email: trevorrowe@gmail.com
|