0
我正在使用Scala的BigQuery。我嘗試了樣品Scala代碼調用谷歌的BigQuery API解析對JSON格式的響應
斯卡拉:
val queryInfo: QueryRequest =
new QueryRequest().setQuery(s"SELECT * FROM $PROJECT_ID:$dataSetId.$tableId;")
val queryRequest: Bigquery#Jobs#Query =
bigquery.jobs().query(PROJECT_ID, queryInfo)
val queryResponse: QueryResponse =
queryRequest.execute()
以上BQ返回:
{
"jobComplete":true,
"jobReference":{
"jobId":"job_xxx",
"projectId":"xxx"
},
"kind":"bigquery#queryResponse",
"rows":[{"f":[{"v":"1"},{"v":"1364206559422"}]}],
"schema": {
"fields":[
{"mode":"NULLABLE","name":"id","type":"STRING"},
{"mode":"NULLABLE","name":"timestamp","type":"INTEGER"}
]
},
"totalRows":"1",
"pageToken":"xxxx"
}
請幫我從JSON格式或改變上述結果解析值查詢返回如下格式的結果:
{"id": "1", "timestamp": "1364206559422"}
我重新標記,因爲它看起來像斯卡拉我。 – Jonathan 2013-03-26 10:52:17
是的,謝謝。你是對的......錯誤修正了 – user2170309 2013-03-26 11:13:11