JSON::HashValueConverter(Converter) - Crystal 0.35.1

# module JSON::HashValueConverter(Converter)

##
Overview

Converter to be used with `JSON::Serializable` to serialize the `Hash(K, V)` values elements with the custom converter.

    require "json"

    class TimestampHash
      include JSON::Serializable

      @[JSON::Field(converter: JSON::HashValueConverter(Time::EpochConverter))]
      birthdays : Hash(String, Time)
    end

    timestamp = TimestampHash.from_json(%({"birthdays":{"foo":1459859781,"bar":1567628762}}))
    timestamp.birthdays # => {"foo" => 2016-04-05 12:36:21 UTC, "bar" => 2019-09-04 20:26:02 UTC)}
    timestamp.to_json   # => {"birthdays":{"foo":1459859781,"bar":1567628762}}

##
Defined in:

##
Class Method Summary

- .from_json(pull : JSON::PullParser)
- .to_json(values : Hash, builder : JSON::Builder)

##
Class Method Detail

def self.from_json(pull : JSON::PullParser) #
def self.to_json(values : Hash, builder : JSON::Builder) #