null is a valid value in a JSON array, so there is no reason forbid
adding null to the array. JsonArray.Save() already handles null values in
the array.
public void Add (JsonValue item)
{
- if (item == null)
- throw new ArgumentNullException ("item");
-
list.Add (item);
}
Assert.AreEqual (JsonType.Array, j.JsonType, "type");
var str = j.ToString ();
Assert.AreEqual (str, "[1, 2, 3, null]");
+ ((JsonArray) j).Add (null);
+ str = j.ToString ();
+ Assert.AreEqual (str, "[1, 2, 3, null, null]");
}
// Test that we correctly serialize JsonObject with null elements.