Module: Tiktok::Open::Sdk::Helpers::StringUtilsHelper

Included in:
ResponseHelper
Defined in:
lib/tiktok/open/sdk/helpers/string_utils_helper.rb

Overview

Utility methods for string and JSON handling.

Instance Method Summary collapse

Instance Method Details

#parse_json(str) ⇒ Hash

Parses a JSON string into a Ruby hash with symbolized keys.



15
16
17
18
19
# File 'lib/tiktok/open/sdk/helpers/string_utils_helper.rb', line 15

def parse_json(str)
  JSON.parse(str, symbolize_names: true)
rescue JSON::ParserError
  { raw: str }
end