如何在json stringify输出中获取特定对象? [英] How would I get the specific object in json stringify output?

查看:86
本文介绍了如何在json stringify输出中获取特定对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能得到全部没有。数组中的3个?



我尝试过的方法:



这里我的javascript:



How would i get the all no. 3 in the array?

What I have tried:

Here my javascript:

var arr_question = [{"$1z_1":3,"$2o_1":"Question 1."},{"$1z_1":3,"$2o_1":"Question2."},{"$1z_1":3,"$2o_1":"Question3."}]





我尝试在json中使用此代码:



I tried using this code in json:

console.log("output: "+arr_question.$1z_1);



但输出未定义



我只想得到所有的3号或全部数组中名为$ 1z_1的对象并将其全部加起来。


but the output is undefined

I just want to get all the no.3 or all the object named $1z_1 in the array and sum it all.

推荐答案

1z_1: 3
1z_1":3,"


2o_1: 问题1。},{
2o_1":"Question 1."},{"


1z_1: 3
1z_1":3,"


这篇关于如何在json stringify输出中获取特定对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆