作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我有一个 JSON 数组:
[
{
"art": "A",
"count": "0",
"name": "name1",
"ean": "802.0079.127",
"marker": "null",
"stammkost": "A",
"tablename": "IWEO_IWBB_01062015"
},
{
"art": "A",
"count": "0",
"name": "2",
"ean": "657.7406.559",
"marker": "null",
"stammkost": "A",
"tablename": "IWEO_IWBB_02062015"
}
]
为了遍历 PHP 中的数组,我将使用以下代码来遍历表名:
foreach($jArray as $value){
$tablename = $value['tablename'];
//some code
}
我如何在 Node.js 中执行此操作?我发现了很多问题,但没有实际答案。其中大部分来自 2011 年。
最佳答案
var tables = [
{ "art":"A","count":"0","name":"name1","ean":"802.0079.127","marker":"null","stammkost":"A","tablename":"IWEO_IWBB_01062015" },
{ "art":"A","count":"0","name":"2","ean":"657.7406.559","marker":"null","stammkost":"A","tablename":"IWEO_IWBB_02062015" }
];
tables.forEach(function(table) {
var tableName = table.name;
console.log(tableName);
});
关于javascript - 如何在 Node.js 中遍历 JSON 数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31254578/
我是一名优秀的程序员,十分优秀!