Added fallback for json serialiaze for php 5.3