class Grape::Validations::Types::JsonArray
Specialization of the {Json} attribute that is guaranteed to return an array of objects. Accepts both JSON-encoded objects and arrays of objects, but wraps single objects in an Array.
Public Instance Methods
coerce(input)
click to toggle source
See {Json#coerce}. Wraps single objects in an array.
@param input [String] JSON-encoded parameter value @return [Array<Hash>]
Calls superclass method
Grape::Validations::Types::Json#coerce
# File lib/grape/validations/types/json.rb, line 53 def coerce(input) json = super Array.wrap(json) unless json.nil? end
value_coerced?(value)
click to toggle source
See {Json#coerced_collection?}
# File lib/grape/validations/types/json.rb, line 59 def value_coerced?(value) coerced_collection? value end