首页 > 解决方案 > json.stringify 在 javascript 中返回空数组

问题描述

我有一个我创建的对象,如下所示,

var test=[];
test.car=1
test.bike=2
test.cycle=3

结果:[汽车:1,自行车:2,自行车:3]

我有一个期待的控制器

public ActionResult insertTransport(transportModal test)

当我写出data:JSON.stringify(test) 的值data:JSON.stringify(test)就像[]我需要做的那样来对对象测试进行字符串化时?

标签: javascriptjsonajaxobject

解决方案


推荐阅读