ASP - how to use json_decode in aspx - Asked By zara zara on 18-Mar-18 06:36 AM

Hello

i need to convert this code PHP in ASPX

$response = file_get_contents($url);
$obj = json_decode($response);
print $obj->{'errorCode'}.'<br/>'; 
print $obj->{'orderId'}.'<br/>'; 
print $obj->{'formUrl'}.'<br/>';
print $obj->{'orderId'}.'<br/>';
$url2=$obj->{'formUrl'};
header('Location: ' . $url2, true, false ? 301 : 302);
thank you
Robbe Morris replied to zara zara on 18-Mar-18 11:58 AM
In code behind you would use the HttpClient class to make the call to the url any one of the JSON serialization libraries out there.  NewtonSoft is one.  There are others.  The exact technique would depend a lot on the version of ASP.NET or ASP.NET MVC you are using.