Is Empty

Check if a value is empty (null, empty string, array, or hash).

Code

General
require 'json'
v = value == '' ? '' : JSON.parse(value)
return v.nil? || (v.respond_to?(:empty?) && v.empty?)

Parameters

JSON value to check

Server

More Ruby Snippets