如何访问深度嵌套的 JSON 对象中的项目

How to acces items in deeply nested JSON object?

本文关键字:JSON 对象 项目 嵌套 深度 何访问 访问      更新时间:2023-09-26
Object
meta: Object
objects: Array[4]
    0: Object
    id: 19222
    leaguevine_url: "https://www.leaguevine.com/tournaments/19389/autumn-2013/pools/#19222"
    name: "D"
    resource_uri: "https://api.leaguevine.com/v1/pools/19222/"
    standings: Array[4]
        0: Object
        1: Object
        games_played: 0
        losses: 0
        plus_minus: 0
        points_allowed: 0
        points_scored: 0
        team: Object
        id: 21195
        leaguevine_url: "https://www.leaguevine.com/teams/21195/smokum/"
        name: "Smokum"
        resource_uri: "https://api.leaguevine.com/v1/teams/21195/"
        short_name: ""
        __proto__: Object
        team_id: 21195
        wins: 0
        __proto__: Object
        2: Object
        3: Object
            length: 4
    __proto__: Array[0]
    start_time: "2013-10-21T09:00:00+02:00"
    team_ids: Array[4]
    time_between_rounds: 120
    time_created: "2013-09-30T09:30:46.577758+00:00"
    time_last_updated: "2013-09-30T09:30:46.577791+00:00"
    tournament: Object
    tournament_id: 19389
    __proto__: Object
    1: Object
    2: Object
    3: Object

这些是我从Leaguevine API获得的JSON对象。如何获得团队名称"Smokum"?

除了使用Transparancy微型库将我的JSON对象渲染为我的HTML,但我不知道如何使用Javascript访问对象中的对象。

假设您发布的 JSON 是result,则可以通过以下方式访问属性Smokum

result.objects[0].standings[1].name