Sha256: 928a5112b74456d615b51f96bd35f5a46f4af94a4071c6a23b8f3b69449beb4a
Contents?: true
Size: 586 Bytes
Versions: 1
Compression:
Stored size: 586 Bytes
Contents
require 'json' module IOStreams class Tabular module Parser # For parsing a single line of JSON at a time class Json < Base def parse(row) raise(Tabular::Errors::TypeMismatch, "Format is :json. Invalid input: #{row.class.name}") unless row.is_a?(String) JSON.parse(row) end # Return the supplied array as a single line JSON string. def render(row, header) hash = header.to_hash(row) hash.to_json end def requires_header? false end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
iostreams-0.15.0 | lib/io_streams/tabular/parser/json.rb |