Method: Grape::Validations::Types::Json.parse
- Defined in:
- lib/grape/validations/types/json.rb
.parse(input) ⇒ Hash, ...
Coerce the input into a JSON-like data structure.
18 19 20 21 22 23 24 25 |
# File 'lib/grape/validations/types/json.rb', line 18 def parse(input) return input if parsed?(input) # Allow nulls and blank strings return if input.nil? || input.match?(/^\s*$/) JSON.parse(input, symbolize_names: true) end |