0

我有一个存储在 JSON 中的项目列表。目前,BigQuery 似乎不支持 JSON 数组。我有以下 JSON:

[
    {
        "purchaseId": "f7c67e39-5382-4d08-a308-0e4657143c44",
        "platform": "googleplay",
        "createdAt": 1364226047214,
        "type": "currency",
        "purchaseDate": 1364225968000,
        "updatedAt": 1364226052634
    },
    {
        "purchaseId": "f7c67e39-5382-4d08-a308-0e4657143c44",
        "platform": "googleplay",
        "createdAt": 1364226047214,
        "type": "currency",
        "purchaseDate": 1364225968000,
        "updatedAt": 1364226052634
    },
    {
        "purchaseId": "f7c67e39-5382-4d08-a308-0e4657143c44",
        "platform": "googleplay",
        "createdAt": 1364226047214,
        "type": "currency",
        "purchaseDate": 1364225968000,
        "updatedAt": 1364226052634
    }
]

我收到以下错误:

    Line:1 / Column:1, Expected '{' found '['

类似以下的内容将是无效的 JSON:

    {
        "purchaseId": "f7c67e39-5382-4d08-a308-0e4657143c44",
        "platform": "googleplay",
        "createdAt": 1364226047214,
        "type": "currency",
        "purchaseDate": 1364225968000,
        "updatedAt": 1364226052634
    },
    {
        "purchaseId": "f7c67e39-5382-4d08-a308-0e4657143c44",
        "platform": "googleplay",
        "createdAt": 1364226047214,
        "type": "currency",
        "purchaseDate": 1364225968000,
        "updatedAt": 1364226052634
    }

那么,对 JSON 中的项目进行分组的最佳方式是什么,然后 BigQuery 可以轻松地使用这些项目呢?

4

1 回答 1

2

我相信输入在技术上是无效的 JSON。它被称为“换行符分隔的 JSON”。每行必须是一个独立的 JSON 字典,末尾有一个换行符。行间没有逗号。

于 2013-04-03T17:10:50.120 回答