ConvertFrom-Json max length

I had the same problem and was able to solve it like this:

[void][System.Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions")        
$jsonserial= New-Object -TypeName System.Web.Script.Serialization.JavaScriptSerializer 
$jsonserial.MaxJsonLength  = 67108864
$Obj = $jsonserial.DeserializeObject($CourseTypesResponse)

You can use $jsonserial.MaxJsonLength to manipulate the MaxJsonLength property

source: https://social.technet.microsoft.com/Forums/windowsserver/en-US/833c99c1-d8eb-400d-bf58-38f7265b4b0e/error-when-converting-from-json?forum=winserverpowershell&prof=required

Leave a Comment