如何在Vega中访问JSON对象中的数组

时间:2019-09-20 15:24:20

标签: vega vega-lite

我正在使用Vega来构建可视化。我有一个指向JSON数据的链接,为:

{
     "messages":{"messages: []",
     "values" : [{"foo": "fooVal", "boo": "booVal", "coo": "cooVal"},
                 {"joo": "jooVal", "loo": "looVal", "moo": "mooVal"}]
}

我想转换数据以便拥有:

[
     {"foo": "fooVal", "boo": "booVal", "coo": "cooVal"},
     {"joo": "jooVal", "loo": "looVal", "moo": "mooVal"}
]

这是我在数据字段中所拥有的:

    "data": [
        {
            "name": "randomData",
            "url": {"signal": "dataUrl"},
            "transform": [
                "type": "project",
                "fields": ["values]
            ]
        },
     ] 

但是,这不起作用,并给我一个e.forEach is not a function错误。我如何将JSON数据更改为以数组而不是如上所述的对象开头?

0 个答案:

没有答案