diff --git a/ext/json/lib/json/add/core.rb b/ext/json/lib/json/add/core.rb index 4423e7ad75..7121a77ff1 100644 --- a/ext/json/lib/json/add/core.rb +++ b/ext/json/lib/json/add/core.rb @@ -96,7 +96,7 @@ class Struct def to_json(*args) klass = self.class.name - klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!" + klass.nil? and raise JSON::JSONError, "Only named structs are supported!" { 'json_class' => klass, 'v' => values,