Read Json Object in Powershell 2.0

前端 未结 1 611
-上瘾入骨i
-上瘾入骨i 2020-12-16 12:47

I am using Powershell 2.0 (cannot make an upgarde to V3.0 as of now) & I want to read the below Json object.

\"{\\\"DevResults\\\":[{\\\"TechnologyName\\         


        
相关标签:
1条回答
  • 2020-12-16 13:32

    You probably have the System.Web.Extensions available, and as such you can load that assembly and use the JSON parser that is available. Here is a quick sample:

    [System.Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions")
    $json = "{a:1,b:2,c:{nested:true}}"
    $ser = New-Object System.Web.Script.Serialization.JavaScriptSerializer
    $obj = $ser.DeserializeObject($json)
    

    Reference: http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx

    0 讨论(0)
提交回复
热议问题