Q:

Newtonsoft.JSON Serialization Array, Object, or Null

I have some JSON that can be a List or null. How do I create a POCO for this JSON?
Here is an example array:
http://pastebin.com/qAZF2Ug9
Here is my POCO:
http://pastebin.com/hUtgyytc
How can I tell Newtonsoft.JSON to ignore the SalesLine object, if it is null?

A:

You can specify the settings:
var settings = new Newtonsoft.Json.JsonSerializerSettings {
    NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore};

and use that in various serializer constructors and serialize calls.
Alternatively, IIRC it supports conditional serialization, i.e.
public bool ShouldSerializeFoo() { return Foo != null; }
// pairs to property Foo

