Forum Discussion

naveens33_'s avatar
naveens33_
Contributor
3 years ago

Get aqHttpResponse as json/dict format

In following python code, I can see aqHttpResponse Object Properties has only Text but actually I required my response to be in json or dict format in-order to parse it. 

 

request = aqHttp.CreateGetRequest(endpoint)
response = request.Send()

 

 

Please suggest how I can get the response in json/dict format or how I can convert this response.Text to json/dict format. 

Note:
eval() function I have used to convert text to dict but it failed for the case like

"status"true

NameError: name 'true' is not defined

  • Hi Locke65 ,

    Found an alternative way through json package and its works fine now,

    import json
    json_ = json.loads('{"records":[{"Id":true}]}')
    Log.Message(json_["records"][0]["Id"])

     

  • Locke65's avatar
    Locke65
    New Contributor

    Did you have a fix on this issue? Challenging a relative issue yet no response from anyone and couldn't see this point taking a gander at in google.

     

    My Balance Now

    • naveens33_'s avatar
      naveens33_
      Contributor

      Hi Locke65 ,

      Found an alternative way through json package and its works fine now,

      import json
      json_ = json.loads('{"records":[{"Id":true}]}')
      Log.Message(json_["records"][0]["Id"])