11 Responses

  1. Robin
    Robin at |

    Extremely well written and helped me clarify just how to get that array of items contained with [ ] for a JSON string. Crucial step was also -Depth. Thanks!

  2. Sanjeev Sharma
    Sanjeev Sharma at |

    Excellent information. I was struggling with System.Collections.Hashtable for a couple of days till I came across this article. Thank you !

  3. Marc
    Marc at |

    Any idea how to get a JSON representation of a Hashtable such as this:
    @{Path=”C:\temp”; Filter=”*.js”}

    If you ConvertTo-Json you get
    “Path”: “C:\\temp”,
    “Filter”: “*.js”

    but if you convert that JSON back with ConvertFrom-Json you don’t get a HashTable but a PSCustomObject.

  4. William
    William at |

    The DEPTH parameter, exactly what I was looking for. Thank you!

  5. krsh
    krsh at |

    It’s very helpful. Thanks alot…..

  6. fhneundr6ie4d6un
    fhneundr6ie4d6un at |

    Thanks a lot. Very very helpfull to start with powershell and json

  7. Dany Benjamin
    Dany Benjamin at |

    I’ve searched the entire web to figure out why powershell adds the ‘@’ symbol to all my JSONs. I needed it as a fully expanded JSON to submit to an API I was using (ambari). After two days of searching all of the internet, I am thankful that I found this page with the ‘Depth’ parameter.

  8. Ómar Örn Magnússon
    Ómar Örn Magnússon at |

    It’s very helpful. Thanks 🙂

  9. Ben Taylor
    Ben Taylor at |

    Well written. Clear, clean and concise. I’ve kept this as my defacto JSON formatting guide. Thank you and BRAVO!

  10. Michael
    Michael at |

    Great article – super helpful!!

  11. Saiteja Bolla
    Saiteja Bolla at |

    Lets say you need an array of hashtable but with a single key value in the hashtable.
    When i convert that variable into JSON i am losing “[ “and” ]”

    example :{
    { Unique_ID: Role_ID}


Share your point of view!