Monday, 15 July 2013

http - How to output json object returned from REST api in powershell? -



http - How to output json object returned from REST api in powershell? -

i trying output console json object beingness returned when phone call url:

http://localhost:999/api/randomobjects/19

where randomobjects type of object , 19 object id. far, way have gotten json output console in powershell using webclient , saving json folder outputting it.

$storagedir = "c:\path\to\folder" $webclient = new-object system.net.webclient $url = "http://localhost:999/api/randomobjects/19" $file = "$storagedir/demofile.json" $webclient.downloadfile($url,$file) cat $file

is there way straight output json object console without saving in file?

there sure is: see convertto-json , convertfrom-json cmdlets. these transform , javascript object notation textual format custom psobject can query , manipulate using regular tricks of trade.

json http rest powershell

No comments:

Post a Comment