class
Amber::Schema::Parser::JSONParser
- Amber::Schema::Parser::JSONParser
- Amber::Schema::Parser::Base
- Reference
- Object
Defined in:
amber/schema/parsers/json_parser.crClass Method Summary
-
.create_parse_error(json_string : String, error : JSON::ParseException) : SchemaDefinitionError
Create detailed parse error with context
-
.extract_fields(json : JSON::Any, schema : Definition | Nil = nil) : Hash(String, JSON::Any)
Extract fields from JSON structure based on schema definition
-
.parse_multipart(params : Hash(String, String | Array(String)) | Hash(String, String | Array(String) | HTTP::FormData::Part), limits : Amber::Configuration::ParamsConfig = Amber.settings.params) : Hash(String, JSON::Any)
Parse multipart form data with file upload support
-
.parse_params(params : HTTP::Params, limits : Amber::Configuration::ParamsConfig = Amber.settings.params) : Hash(String, JSON::Any)
Parse HTTP::Params into JSON-compatible hash with proper nesting
-
.parse_request(request : HTTP::Request) : Hash(String, JSON::Any)
Parse HTTP request body
-
.parse_request_body(body : String) : Hash(String, JSON::Any)
Parses a request body like
.parse_string, except that malformed JSON raisesRequestParseError(400), which the request remembers like any other rejected body. -
.parse_string(json_string : String) : Hash(String, JSON::Any)
Parse raw JSON string into Hash suitable for schema validation
-
.validate_json(json : JSON::Any, schema : Definition) : Array(Error)
Validate JSON against schema (used for error reporting)
Instance Method Summary
- #can_parse?(value : JSON::Any) : Bool
-
#parse(value : JSON::Any) : JSON::Any
Instance methods for Parser::Base interface
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
Create detailed parse error with context
Extract fields from JSON structure based on schema definition
Parse multipart form data with file upload support
Parse HTTP::Params into JSON-compatible hash with proper nesting
Parse HTTP request body
Parses a request body like .parse_string, except that malformed JSON
raises RequestParseError (400), which the request remembers like
any other rejected body.
Parse raw JSON string into Hash suitable for schema validation
Validate JSON against schema (used for error reporting)