Windows PowerShell Home
ConvertFrom-JSON doesn't allow you to modify the maxJSONLength value
Mark E. Schill
9/18/2013 7:58:55 AM
User(s) can reproduce this bug
ConvertFrom-JSON doesn't allow you to modify the maxJSONLength value. By default it is set to 2MB so if you have a JSON string that is longer it will error out trying to convert to a PowerShell object.
How often does this happen?
Have you seen this problem before in this product?
No, this is new to the most recent version
Use ConvertFrom-JSON on any string over 2MB.
Should successfully convert the JSON string to a PowerShell object.
to post a comment.
Please enter a comment.
on 10/3/2013 at 4:58 AM
While the workaround does process larger files (e.g. >100Mb) it does not produce a blank line between each item from the original json (as ConvertFrom-Json does). This means it cannot be passed into ConvertTo-Csv.
Is there a way in which ConvertFrom-Json can have the value increased directly retaining its expected function.
to post a workaround.
Please enter a workaround.
on 9/28/2013 at 9:36 PM
$json = get-content "Y:\Desktop\bookmarks.json"
# $json | convertfrom-json # fails
$jsser.MaxJsonLength = $jsser.MaxJsonLength * 10
$jsser.RecursionLimit = 99
$outObject = $jsser.DeserializeObject($json)
© 2014 Microsoft