Extract data from string file returned from System.Net.WebClient


i'm using powershell send sms through sms gateway provider.  the sending works great last line of code: 
$wc.downloadstring($url) | out-file c:\result.txt
result.txt looks this:

{
    "message-count": "1",
    "messages": [{
        "to": "11234567899",
        "message-id": "0d0000001b0ab5ed",
        "status": "0",
        "remaining-balance": "1.92020000",
        "message-price": "0.00570000",
        "network": "310004"
    }]
}

the part care status in case it's zero, two-digit number.  i'd extract value of status line , put in it's own file called r.txt  with r.txt containing 0

is possible , if me pointed in right direction.

thanks,
kevin


$return = '{ 	"message-count": "1", 	"messages": [{ 		"to": "11234567899", 		"message-id": "0d0000001b0ab5ed", 		"status": "0", 		"remaining-balance": "1.92020000", 		"message-price": "0.00570000", 		"network": "310004" 	}] }' ($return | convertfrom-json).messages.status


\_(ツ)_/



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Group Policy Event ID 1058 Error Code 1326 (The user name or password is incorrect)

Suspicious event log Event ID: 4905

DCOM received error "2147746132" from...