Continuing on from earlier, after I discovered that FireFox includes far more bookmark information in its native format (JSON) I wanted to create a parser for that instead. Normally PowerShell provides you two simple ways of doing this: ConvertFrom-Json and ConvertTo-Json.
Unfortunately ConvertFrom-Json is a weak link in this chain as it does not allow you to define the maximum length of the input string or recursion level, and can easily crash with an error:
However after all of this work, it turned out I did not need to do any of this.
Firstly because my initial size issue was caused by a bad file that had doubled-up contents; re-exporting produced a file half the size which did not trigger any problem in ConvertFrom-Json at all.
$jsonTree.GetType() | Select-Object -Property UnderlyingSystemType # System.Collections.Generic.Dictionary`2[String,Object] # Leading to... New-Object "System.Collections.Generic.Dictionary[String, Object]"
Which is easy to do, and easy to manipulate; no need to use PowerShell custom objects at all.