Snowflake 错误解析 JSON:未完成的字符串,pos <number>

Snowflake Error parsing JSON: unfinished string, pos <number>

我正在尝试从 snowflake 中的“天气”table 中查询名为“JsonCode”的 varchar 列。 “Json代码”列如下所示:

{
  "Date": "2019-11-07T12:28:18",
  "CurrentTemp": "47°F",
  "WeatherIconStatus": "clear-day",
  "LowTemp": "21°F",
  "HighTemp": "50°F",
  "WindSpeed": "6 mph",
  "TempCategory": "Hot",
  "ForecastData": [
    {
      "Date": "2019-11-08T00:00:00",
      "WeatherIconStatus": "clear-day",
      "LowTemp": "26°F",
      "HighTemp": "51°F",
      "WindSpeed": "3 mph"
    },
    {
      "Date": "2019-11-09T00:00:00",
      "WeatherIconStatus": "clear-day",
      "LowTemp": "28°F",
      "HighTemp": "56°F",
      "WindSpeed": "7 mph"
    }
  ],
  "PrecipitationReportData": {
    "ReportDateTimeAsDate": "2019-11-07T04:45:14",
    "PrecipitationConditions": "",
    "ForecastText": "Clear",
    "NewPrecipitationReadings": {
      "Overnight": {
        "PrecipitationReading": "0in"
      },
      "TwentyFourHours": {
        "PrecipitationReading": "0in"
      },
      "FortyEightHours": {
        "PrecipitationReading": "0in"
      },
      "SevenDays": {
        "PrecipitationReading": "0in"
      }
    },
    "AreaReadings": {
      "City": {
        "PrecipitationReading": "0in"
      },
      "Town": {
        "PrecipitationReading": "0in"
      },
      "Highway": {
        "PrecipitationReading": null
      }
    },
    "SeasonPrecipitation": {
      "PrecipitationReading": "44in"
    }
  },
  "Links": [
    {
      "Href": "https://weather.com",
      "Rel": "self",
      "Method": "GET"
    }
  ]
}

我特意想抓取 2019-11-07 的“WindSpeed”数据。我创建了一个如下所示的查询。

SELECT value:WindSpeed::varchar FROM "DATABASE"."DBO"."WEATHER" 
    , lateral flatten(input => PARSE_JSON(JsonCode):windspeed);

我收到的回复是

Error parsing JSON: unfinished string, pos <number>

我找不到关于此错误的任何文档。任何帮助表示赞赏。 注意:由于有多天的预测数据,我删除了一些 Json。

这应该可以在不需要横向展平的情况下工作:

select parse_json(j):WindSpeed
from data

使用发布的样本 JSON:

with data as (
select $${
  "Date": "2019-11-07T12:28:18",
  "CurrentTemp": "47°F",
  "WeatherIconStatus": "clear-day",
  "LowTemp": "21°F",
  "HighTemp": "50°F",
  "WindSpeed": "6 mph",
  "TempCategory": "Hot",
  "ForecastData": [
    {
      "Date": "2019-11-08T00:00:00",
      "WeatherIconStatus": "clear-day",
      "LowTemp": "26°F",
      "HighTemp": "51°F",
      "WindSpeed": "3 mph"
    },
    {
      "Date": "2019-11-09T00:00:00",
      "WeatherIconStatus": "clear-day",
      "LowTemp": "28°F",
      "HighTemp": "56°F",
      "WindSpeed": "7 mph"
    }
  ],
  "PrecipitationReportData": {
    "ReportDateTimeAsDate": "2019-11-07T04:45:14",
    "PrecipitationConditions": "",
    "ForecastText": "Clear",
    "NewPrecipitationReadings": {
      "Overnight": {
        "PrecipitationReading": "0in"
      },
      "TwentyFourHours": {
        "PrecipitationReading": "0in"
      },
      "FortyEightHours": {
        "PrecipitationReading": "0in"
      },
      "SevenDays": {
        "PrecipitationReading": "0in"
      }
    },
    "AreaReadings": {
      "City": {
        "PrecipitationReading": "0in"
      },
      "Town": {
        "PrecipitationReading": "0in"
      },
      "Highway": {
        "PrecipitationReading": null
      }
    },
    "SeasonPrecipitation": {
      "PrecipitationReading": "44in"
    }
  },
  "Links": [
    {
      "Href": "https://weather.com",
      "Rel": "self",
      "Method": "GET"
    }
  ]
}$$ j
)

select parse_json(j):WindSpeed
from data