added  function serializeObject()

Added function that was required as a part of post.js