module JMESPath

def load_json(path)

Other tags:
    Api: - private
def load_json(path)
  JSON.parse(File.open(path, 'r', encoding: 'UTF-8', &:read))
end

def search(expression, data, runtime_options = {})

Returns:
  • (Mixed, nil) - Returns the matched values. Returns `nil` if the

Parameters:
  • data (Hash) --
  • expression (String) -- A valid
def search(expression, data, runtime_options = {})
  data = case data
         when Hash, Struct then data # check for most common case first
         when Pathname then load_json(data)
         when IO, StringIO then JSON.parse(data.read)
         else data
    end
  Runtime.new(runtime_options).search(expression, data)
end