嗨我將JSON數據轉換爲字符串。請在下面找到JSON數據。我面臨的問題是系統無法將NULL值轉換爲字符串。因此,我收到以下錯誤:無法零轉換成字符串(類型錯誤)將JSON數據轉換爲字符串
JSON數據:
{"success":true,"message":null,"data":null}
代碼中使用:
c = Curl::Easy.new(Configuration.fetch("<URL where we can find the above JSON DATA and nothing else>"))
# c.follow_location = true
# c.http_auth_types = :basic
# c.username = Configuration.fetch('auth_user', false)
# c.password = Configuration.fetch('auth_pass', false)
# c.headers["User-Agent"] = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17'
# c.perform
result=JSON.parse(c)
puts result["Success"]
請幫助。
向我們展示您當前正在產生錯誤的嘗試。 – meagar
我編輯了這個問題。希望你現在可以看到代碼。 – san6086