Module for handling JSONL (JSON Lines).
Clone or download
Latest commit a18997e Mar 16, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib v0.1.5 Mar 16, 2017
test Implement `JSONL.generate` Mar 16, 2017
.gitignore Ignore pkg/ Mar 15, 2017
.travis.yml Install bundler on Travis CI Mar 15, 2017
Gemfile Initial commit Mar 15, 2017
LICENSE.txt Initial commit Mar 15, 2017
README.md Add badges to README Mar 15, 2017
Rakefile Initial commit Mar 15, 2017
jsonl.gemspec Initial commit Mar 15, 2017

README.md

JSONL

Gem Version Build Status

JSONL is just a module for handling JSONL (JSON Lines) parsing with JSON module.

Installation

Add this line to your application's Gemfile:

gem 'jsonl'

And then execute:

$ bundle

Or install it yourself as:

$ gem install jsonl

Usage

To parse JSONL text, just pass the source to JSONL.parse, which transfers the processing to JSON.parse.

source.jsonl:

{"name": "Gilbert", "wins": [["straight", "7♣"], ["one pair", "10♥"]]}
{"name": "Alexa", "wins": [["two pair", "4♠"], ["two pair", "9♠"]]}
{"name": "May", "wins": []}
{"name": "Deloise", "wins": [["three of a kind", "5♣"]]}
require 'jsonl'

source = File.read('source.jsonl')

parsed = JSONL.parse(source)
parsed.class #=> Array
parsed.count #=> 4
parsed[0] #=> {"name"=>"Gilbert", "wins"=>[["straight", "7♣"], ["one pair", "10♥"]]}

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/kami-zh/jsonl.

License

The gem is available as open source under the terms of the MIT License.