Skip to content

Commit

Permalink
refactor: remove multi_json with json_pure (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
strehle authored Oct 30, 2024
1 parent b7917df commit e38babe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cf-uaa-lib.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Gem::Specification.new do |s|
s.require_paths = ['lib']

# dependencies
s.add_dependency 'multi_json', '>= 1.12.1', '< 1.16'
s.add_dependency 'json_pure', '~>2.7'
s.add_dependency 'httpclient', '~> 2.8', '>= 2.8.2.4'
s.add_dependency 'addressable', '~> 2.8', '>= 2.8.0'

Expand All @@ -41,7 +41,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'simplecov', '~> 0.22.0'
s.add_development_dependency 'simplecov-rcov', '~> 0.3.0'
s.add_development_dependency 'ci_reporter', '>= 1.9.2', '~> 2.0'
s.add_development_dependency 'json_pure', '>= 1.8.1', '~> 2.5'
s.add_development_dependency 'json_pure', '~>2.7'
s.add_development_dependency 'ci_reporter_rspec', '~> 1.0'

end
10 changes: 5 additions & 5 deletions lib/uaa/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# subcomponent's license, as noted in the LICENSE file.
#++

require 'multi_json'
require 'json/pure'
require "base64"
require 'logger'
require 'uri'
Expand Down Expand Up @@ -141,11 +141,11 @@ def self.encode_form(obj)

# Converts +obj+ to JSON
# @return [String] obj in JSON form.
def self.json(obj) MultiJson.dump(obj) end
def self.json(obj) JSON.dump(obj) end

# Converts +obj+ to nicely formatted JSON
# @return [String] obj in formatted json
def self.json_pretty(obj) MultiJson.dump(obj, pretty: true) end
def self.json_pretty(obj) JSON.pretty_generate(obj) end

# Converts +obj+ to a URL-safe base 64 encoded string
# @return [String]
Expand Down Expand Up @@ -182,8 +182,8 @@ def self.decode64(str)
# @param style (see Util.hash_key)
# @return [Hash] parsed data
def self.json_parse(str, style = nil)
hash_keys!(MultiJson.load(str), style) if str && !str.empty?
rescue MultiJson::DecodeError
hash_keys!(JSON.parse(str), style) if str && !str.empty?
rescue Exception
raise DecodeError, "json decoding error"
end

Expand Down

0 comments on commit e38babe

Please sign in to comment.