Keeping JSON as small as possible

2 posts, 0 answers
  1. Kenny
    Kenny avatar
    11 posts
    Member since:
    Apr 2014

    Posted 19 Feb 2015 Link to this post

    Hi all,

    I've managed to fill my scheduler its datasource by using my own code which is triggered initially and when the navigate event is triggered.
    I've done this to keep the JSON that is being sent as small as possible so that I don't send events which don't matter for what is being looked at.

    An example of the JSON looks like the block I've added below.

    What I'm trying to do is get rid of the following fieldsl:
    - StartTimezone
    - EndTimezone
    - RecurrenceRule
    - RecurrenceID
    - RecurrenceException

    I'd like to get rid of those fields because I don't use them for anything and I'd like to keep the JSON as small as possible.
    I have my own custom event editor template which doesn't use them anyway.

    My schedulerEventViewModel implements ISchedulerEvent so it must have those properties defined.
    I've tried quite some things like putting [JsonIgnore] attributes above the properties but that does not help as they keep getting serialized.

    Anyone got an idea?

    Thanks in advance.

    Kind regards,
    Yannick

    [{"TaskID":82785,"Title":null,"Description":null,"State":0,"Start":"\/Date(1424041201000)\/","End":"\/Date(1424073600000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":67,"OldPersonID":67,"CallgroupID":1,"PersonName":"Yannick Ariën","CallgroupName":"Callgroup1","PersonInitials":"YAR"},{"TaskID":32848,"Title":null,"Description":null,"State":0,"Start":"\/Date(1424073600000)\/","End":"\/Date(1424127599000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":1,"OldPersonID":1,"CallgroupID":1,"PersonName":"Geert Verbakel","CallgroupName":"Callgroup1","PersonInitials":"GVE"},{"TaskID":32849,"Title":null,"Description":null,"State":0,"Start":"\/Date(1424131201000)\/","End":"\/Date(1424190600000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":1,"OldPersonID":1,"CallgroupID":1,"PersonName":"Geert Verbakel","CallgroupName":"Callgroup1","PersonInitials":"GVE"},{"TaskID":82914,"Title":"No title","Description":null,"State":0,"Start":"\/Date(1424190600000)\/","End":"\/Date(1424203200000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":4,"OldPersonID":4,"CallgroupID":1,"PersonName":"Stefan Debing","CallgroupName":"Callgroup1","PersonInitials":"SDE"},{"TaskID":82915,"Title":"No title","Description":null,"State":0,"Start":"\/Date(1424203200000)\/","End":"\/Date(1424213999000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":1,"OldPersonID":1,"CallgroupID":1,"PersonName":"Geert Verbakel","CallgroupName":"Callgroup1","PersonInitials":"GVE"},{"TaskID":32843,"Title":null,"Description":null,"State":0,"Start":"\/Date(1424221200000)\/","End":"\/Date(1424246400000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":67,"OldPersonID":67,"CallgroupID":1,"PersonName":"Yannick Ariën","CallgroupName":"Callgroup1","PersonInitials":"YAR"},{"TaskID":32834,"Title":null,"Description":null,"State":0,"Start":"\/Date(1424250000000)\/","End":"\/Date(1424257200000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":1,"OldPersonID":1,"CallgroupID":1,"PersonName":"Geert Verbakel","CallgroupName":"Callgroup1","PersonInitials":"GVE"},{"TaskID":32833,"Title":"No title","Description":null,"State":0,"Start":"\/Date(1424257200000)\/","End":"\/Date(1424264400000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":4,"OldPersonID":4,"CallgroupID":1,"PersonName":"Stefan Debing","CallgroupName":"Callgroup1","PersonInitials":"SDE"},{"TaskID":32835,"Title":null,"Description":null,"State":0,"Start":"\/Date(1424264400000)\/","End":"\/Date(1424271600000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":1,"OldPersonID":1,"CallgroupID":1,"PersonName":"Geert Verbakel","CallgroupName":"Callgroup1","PersonInitials":"GVE"},{"TaskID":82823,"Title":"No title","Description":null,"State":0,"Start":"\/Date(1424386801000)\/","End":"\/Date(1424404800000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":67,"OldPersonID":67,"CallgroupID":1,"PersonName":"Yannick Ariën","CallgroupName":"Callgroup1","PersonInitials":"YAR"},{"TaskID":82821,"Title":"No title","Description":null,"State":0,"Start":"\/Date(1424404800000)\/","End":"\/Date(1424408400000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":4,"OldPersonID":4,"CallgroupID":1,"PersonName":"Stefan Debing","CallgroupName":"Callgroup1","PersonInitials":"SDE"},{"TaskID":82822,"Title":"No title","Description":null,"State":0,"Start":"\/Date(1424408400000)\/","End":"\/Date(1424421000000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":1,"OldPersonID":1,"CallgroupID":1,"PersonName":"Geert Verbakel","CallgroupName":"Callgroup1","PersonInitials":"GVE"},{"TaskID":32836,"Title":"No title","Description":null,"State":0,"Start":"\/Date(1424421000000)\/","End":"\/Date(1424430000000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":67,"OldPersonID":67,"CallgroupID":1,"PersonName":"Yannick Ariën","CallgroupName":"Callgroup1","PersonInitials":"YAR"},{"TaskID":32841,"Title":null,"Description":null,"State":0,"Start":"\/Date(1424430000000)\/","End":"\/Date(1424440800000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":4,"OldPersonID":4,"CallgroupID":1,"PersonName":"Stefan Debing","CallgroupName":"Callgroup1","PersonInitials":"SDE"},{"TaskID":32840,"Title":null,"Description":null,"State":0,"Start":"\/Date(1424440800000)\/","End":"\/Date(1424447999000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":67,"OldPersonID":67,"CallgroupID":1,"PersonName":"Yannick Ariën","CallgroupName":"Callgroup1","PersonInitials":"YAR"},{"TaskID":32842,"Title":null,"Description":null,"State":0,"Start":"\/Date(1424447999000)\/","End":"\/Date(1424462400000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":67,"OldPersonID":67,"CallgroupID":1,"PersonName":"Yannick Ariën","CallgroupName":"Callgroup1","PersonInitials":"YAR"},{"TaskID":32838,"Title":null,"Description":null,"State":0,"Start":"\/Date(1424462400000)\/","End":"\/Date(1424473199000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":67,"OldPersonID":67,"CallgroupID":1,"PersonName":"Yannick Ariën","CallgroupName":"Callgroup1","PersonInitials":"YAR"},{"TaskID":32832,"Title":null,"Description":null,"State":0,"Start":"\/Date(1424473201000)\/","End":"\/Date(1424494800000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":1,"OldPersonID":1,"CallgroupID":1,"PersonName":"Geert Verbakel","CallgroupName":"Callgroup1","PersonInitials":"GVE"},{"TaskID":32837,"Title":"No title","Description":null,"State":0,"Start":"\/Date(1424494800000)\/","End":"\/Date(1424505600000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":67,"OldPersonID":67,"CallgroupID":1,"PersonName":"Yannick Ariën","CallgroupName":"Callgroup1","PersonInitials":"YAR"},{"TaskID":32839,"Title":null,"Description":null,"State":0,"Start":"\/Date(1424505600000)\/","End":"\/Date(1424512800000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":67,"OldPersonID":67,"CallgroupID":1,"PersonName":"Yannick Ariën","CallgroupName":"Callgroup1","PersonInitials":"YAR"},{"TaskID":32850,"Title":null,"Description":null,"State":0,"Start":"\/Date(1424518200000)\/","End":"\/Date(1424557800000)\/","StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"RecurrenceID":null,"RecurrenceException":null,"IsAllDay":false,"ApplyCallgroupOffsets":false,"PersonID":1,"OldPersonID":1,"CallgroupID":1,"PersonName":"Geert Verbakel","CallgroupName":"Callgroup1","PersonInitials":"GVE"}]
  2. Kenny
    Kenny avatar
    11 posts
    Member since:
    Apr 2014

    Posted 20 Feb 2015 Link to this post

    Ok ... we just return json without these properties and apparantly the controller doesn't complain about this client-side.
    In addition I made the property names smaller and map them on the clientside.

    Solved :)
Back to Top