jsonl

Version, currently 0.1.01 version
  • 0.1.0latestAug 15, 2023

github.com/Sija/jsonl.cr

Crystal shard for handling JSONL (JSON Lines) parsing

2 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  jsonl:
    github: Sija/jsonl.cr
    version: ~> 0.1.0

Then run:

shards install

shard.yml

Crystal
1.9.2
License
MIT
Author
Sijawusz Pur Rahnama

Dependencies

Development Dependencies

  • ameba~> 1.5.0github: crystal-ameba/amebadev

README

JSONL

CI Releases License

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

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      jsonl:
        github: Sija/jsonl.cr
  2. Run shards install

Usage

require "jsonl"
arr = JSONL.parse <<-JSONL
  {"foo": "bar"}
  [1, 2, 3]
  "foo"
  JSONL

arr.class # => Array(JSON::Any)
class User
  include JSON::Serializable

  property id : Int32
  property first_name : String
  property last_name : String
end

users = User.from_jsonl <<-JSONL
  {"id": 1, "first_name": "John", "last_name": "Doe"}
  {"id": 2, "first_name": "Mary", "last_name": "Poppins"}
  {"id": 3, "first_name": "Jack", "last_name": "Black"}
  JSONL

users.class # => Array(User)

Contributing

  1. Fork it (https://github.com/Sija/jsonl.cr/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors