gpt4 book ai didi

javascript - 使用 JavaScript 或 jQuery 读取数组 JSON

转载 作者:行者123 更新时间:2023-11-30 18:09:38 25 4
gpt4 key购买 nike

<分区>

我有下一个数组 json,我该如何读取它?我已经尝试使用 document.write(arr),它可以工作,但是如果我输入 document.write(arr[0].Category),它会显示 undefined ,

var arr = [{"Category":
{"cell":{"question1":{"que1":"What is the cell?"},
"option1":{"op1":"The cell is the basic structural and functional unit",
"op2":"is a fictional supervillain in Dragon Ball"},"answer1":"opt1"}}},
{"Category":{"Mars":{"question1":{"que1":"How many moons does Mars?"},
"option1":{"op1":"5","op2":"2"},"answer1":"opt2"}}}]

顺便说一句,数组格式很好,因为如果我执行 document.write(arr) 它会返回相同的数组

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com