Interpreting javascript toSource()

Interpreting javascript toSource()

本文关键字:toSource javascript Interpreting      更新时间:2023-09-26

当我对谷歌电子表格进行查询后调用response.toSource()时,我得到了以下内容。

({
    ej: "0.6",
    Oe: "ok",
    gb: [],
    hb: [],
    Cg: "407260946",
    g: {
        zb: "0.6",
        z: [{
            id: "B",
            label: "",
            type: "string",
            pattern: ""}],
        D: [{
            c: [{
                v: "'"My data'""}]}],
        Na: null
    }
})​

我想访问字符串"我的数据"并将其存储在var中,我该如何做到这一点?

好吧,"My data"是数组中键v的值,它是存储在数组中的键c的值,该数组是存储在具有键g的对象中的密钥D的值。所以这是

var myData = response["g"]["D"][0]["c"][0]["v"];