Sha256: ad8870ba970d1256d9d50c7406e975447817f5d55dc39f724faa3b61b7e171db

Contents?: true

Size: 419 Bytes

Versions: 1

Compression:

Stored size: 419 Bytes

Contents

require "json/api/version"
require 'json'
require 'json-schema'

module JSON
  module Api
    def self.parse(source, opts={})
      json = JSON.parse(source, opts)

      validate(json, opts)

      json
#    rescue
#      nil
    end

    def self.validate(source, opts={})
      json = JSON.parse(source) if source.kind_of?(String)

      JSON::Validator.validate!('lib/json/api/schema.json', json)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
json-api-0.1.0 lib/json/api.rb