将 json 对象属性提取到数组中的简单方法?
给定以下 JSON 对象,是否有一种简单的方法可以仅提取 results
对象属性的值?
var j={"success":true,
"msg":["Clutch successfully updated."],
"results":{"count_id":2,
"count_type":"Clutch",
"count_date":"2000-01-01",
"fish_count":250,
"count_notes":"test"}
};
var arr= doSomething(j.results);
//arr=[2, "Clutch","2000-01-01",250,"test"]
Given the following JSON object, is there an easy way to extract just the values of the results
object properties?
var j={"success":true,
"msg":["Clutch successfully updated."],
"results":{"count_id":2,
"count_type":"Clutch",
"count_date":"2000-01-01",
"fish_count":250,
"count_notes":"test"}
};
var arr= doSomething(j.results);
//arr=[2, "Clutch","2000-01-01",250,"test"]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的函数会是这样的
Your function would be something like