Works for me. Parentheses make sure get-content is done before piping. Default depth of convertto-json is 2, which is often too low.
function pjson ($jsonfile) {
(get-content $jsonfile) | convertfrom-json | convertto-json -depth 100 |
set-content $jsonfile
}
Related Contents:
- PowerShell : retrieve JSON object by field value
- How do I update JSON file using PowerShell
- How to load a JSON file and convert it to an object of a specific type?
- Iterating through a JSON file PowerShell
- How to parse JSON from the Invoke-WebRequest in PowerShell?
- How to save a JSON object to a file using Powershell?
- How do I get ASP.NET Web API to return JSON instead of XML using Chrome?
- Are multi-line strings allowed in JSON?
- Posting a File and Associated Data to a RESTful WebService preferably as JSON
- Explanation of JSONB introduced by PostgreSQL
- How to count items in JSON object using command line?
- How can I pretty-print JSON using Go?
- Reading in a JSON File Using Swift
- Removing fields from struct or hiding them in JSON Response
- What is deserialize and serialize in JSON?
- What are the differences between application/json and application/x-www-form-urlencoded?
- REST API Best practices: args in query string vs in request body
- What is “406-Not Acceptable Response” in HTTP?
- Postman: sending nested JSON object
- How to exclude properties from Swift Codable?
- Type ‘{}’ is not assignable to type ‘IntrinsicAttributes & IntrinsicClassAttributes
- How do I use custom keys with Swift 4’s Decodable protocol?
- Unix command-line JSON parser? [closed]
- Modify a key-value in a json using jq in-place
- Exceptions in Yesod
- How do I make a JSON object with multiple arrays?
- Sending nested JSON object using HTTPie
- Parse JSON from JQuery.ajax success data
- How to return a complex JSON response with Node.js?
- Convert string to json in jq [duplicate]
- Is there a streaming API for JSON? [closed]
- Check if field exists in json type column PostgreSQL
- jq select value from array
- Display all sites and bindings in PowerShell
- how to convert json string to json object in dart flutter?
- JSON and escaping characters
- Cannot unmarshal string into Go value of type int64
- How to create a JSONObject from String in Kotlin?
- Swift 4 Decodable with keys not known until decoding time
- Jackson ObjectMapper with UTF-8 encoding?
- Why Thrift, Why not HTTP RPC(JSON+gzip)
- How to open Visual Studio Code’s ‘settings.json’ file?
- When using Spring MVC for REST, how do you enable Jackson to pretty-print rendered JSON?
- What is the purpose of tsconfig.json?
- AngularJS $http-post – convert binary to excel file and download
- How to extract a field from each object in an array with jq?
- How would you design JSON Schema for an arbitrary key?
- JSON Invalid UTF-8 middle byte
- loading .json files generates 404 errors
- Powershell ConvertTo-json with embedded hashtable