As you can see, when I put a nil value at the end of the array, it removes the other nil value and the 5. The error occurs when the last value in an array is nil.
print(game:GetService(“HttpService”):JSONEncode({1, nil, 3}))
[1,null,3]
print(game:GetService(“HttpService”):JSONEncode({1, 4,{1, nil, 3}, nil, 5}))
[1,4,[1,null,3],null,5]
print(game:GetService(“HttpService”):JSONEncode({1, 4,{1, nil, 3}, nil, 5, nil}))
[1,4,[1,null,3]]
print(game:GetService(“HttpService”):JSONEncode({1, 4,{1, nil, 3, nil}, nil, 5, nil}))
[1,4,[1]]
print(game:GetService(“HttpService”):JSONEncode({1, 4,{1, nil, 3, nil}, nil, 5, nil, nil}))
[1,4,[1],null,5]
print(game:GetService(“HttpService”):JSONEncode({1, 4,{1, nil, 3, nil}, nil, 5, nil, nil, nil}))
[1,4,[1]]
print(game:GetService(“HttpService”):JSONEncode({1, 4,{1, nil, 3, nil}, nil, 5, nil, nil, nil, nil}))
[1,4,[1]]
The behavior seems to vary with different numbers of trailing nil values.