Skip to content

Latest commit

 

History

History
39 lines (25 loc) · 768 Bytes

README.md

File metadata and controls

39 lines (25 loc) · 768 Bytes

Casandra

A drop-in shard for case aware JSON serialization.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      casandra:
        github: grkek/casandra
  2. Run shards install

Usage

require "casandra"

class User
  include JSON::Serializable

  property first_name : String
  property last_name : String

  def initialize(@first_name : String, @last_name : String)
  end
end

puts User.new(first_name: "Jane", last_name: "Doe").to_json case: :camel # {"firstName":"Jane","lastName":"Doe"}
pp User.from_json(%({"firstName": "John", "lastName": "Doe"}), case: :camel) # <User:0x10db93e20 @first_name="John", @last_name="Doe">

Contributors