Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

CPU goes 100% when you read .HAR file with ConvertFrom-JSON


In Chrome DevTools, you can export the contents in the Network tab into a JSON file (.HAR file).

Chrome cannot export the contents of the spreadsheet in the Network tab into .csv or .xlsx format. If you want to get these contents, you have to read the .HAR file and convert it to .csv format.


When you read a .HAR file with ConvertFrom-JSON cmdlet in PowerShell, the CPU which runs powershell.exe goes 100%, and the console which runs powershell.exe respond to Ctrl-C.

PS > Get-Content .\new-tab-page.har | ConvertFrom-Json


.HAR files that Chrome exported are encoded with UTF-8. ConvertFrom-Json falls into a kind of infinity loop when it reads inappropriately encoded strings.


Explicitly specify the encoding of the .HAR file when you read it.

PS > Get-Content .\new-tab-page.har -Encoding UTF8 | ConvertFrom-Json

@{version=1.2; creator=; pages=System.Object[]; entries=System.Object[]}