Usuń właściwości zerowe obiektu wysłanego do Json MVC

namespace Booking.Areas.Golfy.Models
{
    public class Time
    {
        public string   time            { get; set; }
        public int      holes           { get; set; }
        public int      slots_available { get; set; }
        public decimal? price           { get; set; }
        public int?     Nextcourseid    { get; set; }

        public bool ShouldSerializeNextcourseid
        {
            get
            {
                return this.Nextcourseid != null;
            }
        }

        public bool? allow_extra { get; set; }

        public bool ShouldSerializeallow_extra
        {
            get
            {
                return this.allow_extra != null;
            }
        }
    }
}


namespace Booking.Areas.Golfy.Controllers
{
    public class TeetimesController : Controller
    {
        //
        // GET: /Golfy/Teetimes/
        public ActionResult Index(
            string date,
            int?   courseid = null,
            int?   clubid = null,
            int?   holes = null,
            int?   available = null,
            int?   prices = null
        )
        {
            var DateFrom = DateTime.ParseExact(date, "yyyy-MM-dd", CultureInfo.InvariantCulture);

            Teetimes r = BookingManager.GetBookings(new Code.Classes.Params.ParamGetBooking()
            {
                ClubID = clubid
                , DateFrom = DateFrom
                , DateTo = DateFrom.AddDays(1)
                , GroundID = courseid
            });

            return Json(r, JsonRequestBehavior.AllowGet);
        }
    }
}

Powyższa usługa internetowa zwraca ciąg json z kilkoma intencjami Time.

Chciałbym, aby właściwości Nextcourseid i allow_extra zostały pominięte w danych wyjściowych, gdy ich wartości są puste.

Próbowałem ShouldSerializeXxx, ale nie działa.
FYI: Próbowałem także [ScriptIgnore], który działa, ale nie jest warunkowy.

questionAnswers(3)

yourAnswerToTheQuestion