Creating New Objects the JSON way

Share |

Join PowerShell.com!
Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Award-winning PowerShellPlus


Admin Guide to PowerShell Remoting


Mastering PowerShell eBook

There are numerous ways how you can create new objects that you may use to return results from your functions. One way is using JSON, a very simple description language. It is fully supported in PowerShell 3.0. Have a look:

PS> $content = '{"Name":"weltner","FirstName":"tobias","id":123}'
PS> ConvertFrom-Json $content

Name                          FirstName                                                id
----                          -------                                                  --
weltner                       tobias                                                  123

Twitter This Tip! ReTweet this Tip!


Posted Nov 21 2012, 06:00 AM by ps1
Copyright 2012 PowerShell.com. All rights reserved.