Added is_json function, copied from SO.
Added data type check for is_json function.