class URI

Overview

Adds JSON support to URI for use in a JSON mapping.

NOTE require "uri/json" is required to opt-in to this feature.

require "json"
require "uri"
require "uri/json"

class Example
  JSON.mapping uri: URI
end

example = Example.from_json(%({"uri": "http://foo.com/posts?id=30&limit=5#time=1305298413"}))

uri = URI.parse "http://foo.com/posts?id=30&limit=5#time=1305298413"
uri.to_json # => "http://foo.com/posts?id=30&limit=5#time=1305298413"

Defined in:

ext/uri/json.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(pull : JSON::PullParser) #

[View source]

Instance Method Detail

def to_json(json : JSON::Builder) #

[View source]