class Twurl::JsonFormatter
Public Class Methods
format(string)
click to toggle source
# File lib/twurl/request_controller.rb 34 def self.format(string) 35 json = JSON.parse(string) 36 (json.is_a?(Array) || json.is_a?(Hash)) ? JSON.pretty_generate(json) : string 37 rescue JSON::ParserError, TypeError 38 string 39 end