bin/jsonpath in jsonpath-0.4.0 vs bin/jsonpath in jsonpath-0.4.1
- old
+ new
@@ -1,9 +1,9 @@
#!/usr/local/env ruby
require 'jsonpath'
-require 'yajl'
+require 'multi_json'
def usage
puts "jsonpath [expression] (file|string)
If you omit the second argument, it will read stdin, assuming one valid JSON object
@@ -15,10 +15,10 @@
jsonpath = JsonPath.new(ARGV[0])
case ARGV[1]
when nil #stdin
until STDIN.eof?
- puts Yajl::Encoder.encode(jsonpath.on(Yajl::Parser.parse(STDIN.readline)))
+ puts MultiJson.encode(jsonpath.on(MultiJson.decode(STDIN.readline)))
end
when String
- puts Yajl::Encoder.encode(jsonpath.on(Yajl::Parser.parse(File.exist?(ARGV[1]) ? File.read(ARGV[1]) : ARGV[1])))
+ puts MultiJson.encode(jsonpath.on(MultiJson.decode(File.exist?(ARGV[1]) ? File.read(ARGV[1]) : ARGV[1])))
end
\ No newline at end of file