taiyonghai

<script src="~/static/js/jquery.min.js"></script>
<script type="text/javascript">
var list = [];//创建数组
var a1 = {};//创建对象
a1.t = "a";
a1.v = "b,s,g";
var a2 = {};
a2.t = "c";
a2.v = "d,h,e";
list.push(a1);//添加对象
list.push(a2);

var j = JSON.stringify(list);//将对象转换为json
console.log(j);

alert(j);

//将字符串转换为json对象

JSON.parse(\'[{"t":"a","v":"b,s,g"},{"t":"c","v":"d,h,e"}]\');
</script>

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2021-11-28
  • 2022-02-27
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-31
  • 2022-02-05
  • 2021-09-12
  • 2021-12-16
  • 2022-01-23
  • 2021-12-13
  • 2021-09-09
相关资源
相似解决方案