如何使用Lotus-Script解码gzip编码的JSON

时间:2019-07-04 15:27:55

标签: json httprequest gzip lotusscript

我从httprequest获得了gzip编码的JSON内容,但我不知道如何在Lotus Script中对其进行解码。

Set webRequest = Session.createhttprequest()


    Call webRequest.Setheaderfield("cache-control", "no-cache")
    Call webRequest.Setheaderfield("Connection", "keep-alive")
    Call webRequest.Setheaderfield("Content-Type", "application/json")
    Call webRequest.Setheaderfield("Authorization", "Bearer " + accessToken)
    Call webRequest.Setheaderfield("Accept", "*/*")
    Call webRequest.Setheaderfield("Host", "graph.microsoft.com")
    Call webRequest.Setheaderfield("accept-encoding", "gzip, deflate")

ret = webRequest.Get(Url)

ForAll b In ret
    responsJSON = responsJSON + Chr(b)
End ForAll

Set jsnav = session.CreateJSONNavigator(responsJSON)

我期望使用JSON,但收到此错误消息“无法解析JSON字符串:无效值。Offset0”

1 个答案:

答案 0 :(得分:2)

您正在使用哪个版本的Domino / Notes?尝试使用10.0.1 FP2,并使用set webRequest.PreferJSONNavigator = true。这将直接重新调整JSONNavigator,并跳过https://www-01.ibm.com/support/docview.wss?uid=ibm10875724

中标识的一些问题