samples/parse-json
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'd-parse'
require 'pp'
json = DParse::Parsers::JSON.new
puts "[#{Time.now}] start"
res = json.apply($stdin.read)
puts "[#{Time.now}] stop"
puts
case res
when DParse::Success
pp res.data
when DParse::Failure
puts res.pretty_message
end