---
title: "往json数组里动态新增一个元素"
author: "fish_bone"
date: "2011-11-10T14:40:59Z"
tags: ["extjs   json   push()"]
categories: ["Web前端"]
slug: "json"
draft: false
lastmod: "2011-11-10T14:40:59Z"
id: 1250270
url: "https://fish-bone.iteye.com/blog/1250270"
---

原数组定义如下：

var param = [{ "name": "calendarId", value: id },

{ "name": "CalendarStartTime", value: dateFormat.call(start, i18n.xgcalendar.dateformat.fulldayvalue + " HH:mm") },

{ "name": "CalendarEndTime", value: dateFormat.call(end, i18n.xgcalendar.dateformat.fulldayvalue + " HH:mm") },

{ "name": "timezone", value: zone }];

需要动态新增一个元素，name=changeAll  value=1

param.push ({ "name": "changeAll", value: 1});