class Amber::Schema::Parser::JSONParser

Defined in:

amber/schema/parsers/json_parser.cr

Class Method Summary

Instance Method Summary

Instance methods inherited from class Amber::Schema::Parser::Base

can_parse?(value : JSON::Any) : Bool can_parse?, parse(value : JSON::Any) : JSON::Any parse

Class Method Detail

def self.create_parse_error(json_string : String, error : JSON::ParseException) : SchemaDefinitionError #

Create detailed parse error with context


[View source]
def self.extract_fields(json : JSON::Any, schema : Definition | Nil = nil) : Hash(String, JSON::Any) #

Extract fields from JSON structure based on schema definition


[View source]
def self.parse_multipart(params : Hash(String, String | Array(String)) | Hash(String, String | Array(String) | HTTP::FormData::Part)) : Hash(String, JSON::Any) #

Parse multipart form data with file upload support


[View source]
def self.parse_params(params : HTTP::Params) : Hash(String, JSON::Any) #

Parse HTTP::Params into JSON-compatible hash with proper nesting


[View source]
def self.parse_request(request : HTTP::Request) : Hash(String, JSON::Any) #

Parse HTTP request body


[View source]
def self.parse_string(json_string : String) : Hash(String, JSON::Any) #

Parse raw JSON string into Hash suitable for schema validation


[View source]
def self.validate_json(json : JSON::Any, schema : Definition) : Array(Error) #

Validate JSON against schema (used for error reporting)


[View source]

Instance Method Detail

def can_parse?(value : JSON::Any) : Bool #

[View source]
def parse(value : JSON::Any) : JSON::Any #

Instance methods for Parser::Base interface


[View source]