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
Source
# File lib/grape/validations/types/json.rb, line 58 def parse(input) json = super Array.wrap(json) unless json.nil? end
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
Source
# File lib/grape/validations/types/json.rb, line 64 def parsed?(value) coerced_collection? value end
See {Json#coerced_collection?}