<div dir="ltr">Group,<div><br></div><div><br></div><div>Is there a downside to casting responses from a rest response into a json object rather than a generic $var? Here is my function it works but I want to be aware if this will cost a considerable amount of resources.</div><div><br></div><div>
<p class=""><span class=""> if (!rest_get("http:</span><span class="">//<a href="http://myauthurl.com/authme/$fU/$rU">myauthurl.com/authme/$fU/$rU</a>", "$json(authresponse)", "$var(ct)", "$var(rcode)")) {</span></p>
<p class=""><span class=""></span><br></p>
<p class=""><span class=""> xlog("Error code $var(rcode) in HTTP GET!\n")</span><span class="">;</span></p>
<p class=""><span class="">xlog("on account of admittance error we are sending the call to the AS server for processing")</span><span class="">;</span><br><span class=""></span></p>
<p class=""><span class=""> route(4)</span><span class="">;</span></p>
<p class=""><span class="">}</span></p>
<p class=""><span class=""></span><br></p>
<p class=""><span class=""> xlog("got this body response from authority on invite $json(authresponse) with response code $var(rcode)")</span><span class="">;</span></p>
<p class=""><span class=""> xlog("response now casting to json $json(authresponse) ")</span><span class="">;</span></p>
<p class=""><span class=""> $json(authbody) :=</span><span class=""> "{}"</span><span class="">;</span></p>
<p class=""><span class=""></span><br></p>
<p class=""><span class=""> $json(authbody) :=</span><span class=""> $json(authresponse)</span><span class="">;</span></p>
<p class=""><span class=""> xlog(" accessing the message $json(authbody/message)")</span><span class="">;</span></p>
<p class=""><span class=""></span><br></p>
<p class=""><span class=""> $json(accept) :=</span><span class=""> $json(authbody/message)</span><span class="">;</span><br></p>
<p class=""><span class=""> xlog(" casted message $json(accept)")</span><span class="">;</span></p>
<p class=""><span class=""> if($json(accept/AcceptCall) =</span><span class="">= "false"){ </span><br></p>
<p class=""><span class=""> xlog("response equal false")</span><span class="">;</span></p>
<p class=""><span class=""> route(3)</span><span class="">;</span></p>
<p class=""><span class=""></span><br></p>
<p class=""><span class=""></span><br></p>
<p class=""><span class=""> }else{</span></p><p class=""><span class=""><br></span></p><p class=""><span class=""><br></span></p><p class=""><span class="">Notice how the response is casted from </span><span class="">$json(authresponse) to </span> $json(authbody) after it is initialized. I came to realize that I had to initialize a variable because I couldn't access keys in <span class=""> </span><span class="">$json(authresponse).</span></p><p class=""><span class=""><br></span></p><p class=""><span class=""><br></span></p><p class=""><span class="">Thanks,</span></p><p class=""><span class="">Tito</span></p></div></div>