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 Class Methods
parse(input)
click to toggle source
See {Json#parse}. Wraps single objects in an array.
@param input [String] JSON-encoded parameter value @return [Array<Hash>]
Calls superclass method
Grape::Validations::Types::Json::parse
# File lib/grape/validations/types/json.rb, line 60 def parse(input) json = super Array.wrap(json) unless json.nil? end
parsed?(value)
click to toggle source
See {Json#coerced_collection?}
# File lib/grape/validations/types/json.rb, line 66 def parsed?(value) coerced_collection? value end