module JSON

def deprecated_singleton_attr_accessor(*attrs)

def deprecated_singleton_attr_accessor(*attrs)
  args = RUBY_VERSION >= "3.0" ? ", category: :deprecated" : ""
  attrs.each do |attr|
    singleton_class.class_eval <<~RUBY
      def #{attr}
        warn "JSON.#{attr} is deprecated and will be removed in json 3.0.0", uplevel: 1 #{args}
        @#{attr}
      end
      def #{attr}=(val)
        warn "JSON.#{attr}= is deprecated and will be removed in json 3.0.0", uplevel: 1 #{args}
        @#{attr} = val
      end
      def _#{attr}
        @#{attr}
      end
    RUBY
  end
end