Work around for json_encode for php version < 5.3