{"record":{"id":"5de60d7e4664f920","repo":"alexreisner/geocoder","slug":"please-install-the-json-or-json-pure-gem-to-parse-geocoder","errorCode":null,"errorMessage":"Please install the 'json' or 'json_pure' gem to parse geocoder results.","messagePattern":"Please install the 'json' or 'json_pure' gem to parse geocoder results\\.","errorType":"exception","errorClass":"LoadError","httpStatus":null,"severity":"error","filePath":"lib/geocoder/lookups/base.rb","lineNumber":9,"sourceCode":"require 'net/http'\nrequire 'net/https'\nrequire 'uri'\n\nunless defined?(ActiveSupport::JSON)\n  begin\n    require 'json'\n  rescue LoadError\n    raise LoadError, \"Please install the 'json' or 'json_pure' gem to parse geocoder results.\"\n  end\nend\n\nmodule Geocoder\n  module Lookup\n\n    class Base\n      def initialize\n        @cache = nil\n      end\n\n      ##\n      # Human-readable name of the geocoding API.\n      #\n      def name\n        fail\n      end\n","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/alexreisner/geocoder/blob/c10bd701215110ebe65da1c8b8b410b124208fd2/lib/geocoder/lookups/base.rb#L1-L27","documentation":"At load time, if ActiveSupport::JSON is not defined, geocoder/lookups/base.rb requires 'json' and converts a LoadError into a descriptive LoadError telling the developer to install the json or json_pure gem, since result parsing depends on it.","triggerScenarios":"Requiring geocoder in a Ruby environment without the json gem and without ActiveSupport loaded (e.g. minimal gemfile, old Ruby without bundled json, JRuby setup missing json_pure).","commonSituations":"Old Ruby versions (<1.9) lacking built-in json, trimmed production deployments, or projects that removed json from the Gemfile.","solutions":["Add gem 'json' to your Gemfile and bundle install","Use gem 'json_pure' as an alternative pure-Ruby parser","Ensure ActiveSupport is loaded (e.g. in Rails apps json is available transitively)","Upgrade Ruby to a version where json is part of the stdlib"],"exampleFix":"// Gemfile before\n# (no json gem)\n// after\ngem 'json'","handlingStrategy":"fallback","validationCode":"begin; require 'json'; rescue LoadError; abort 'install json gem'; end","typeGuard":null,"tryCatchPattern":"begin\n  require 'geocoder'\nrescue LoadError => e\n  abort \"#{e.message} — add gem 'json'\"\nend","preventionTips":["Always include gem 'json' (or run under Rails/ActiveSupport)","Smoke-test `require 'geocoder'` in CI on a bare Ruby image","Keep Ruby version modern where json ships by default"],"tags":["ruby","dependency","json"],"backgroundTag":"missing-dependency","analyzedSha":"c10bd701215110ebe65da1c8b8b410b124208fd2","analyzedAt":"2026-09-15T23:43:32.125Z","contentChangedAt":"2026-09-15T23:43:32.125Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}