簡體   English   中英

JSON文件的Mapreduce Hadoop WordCount示例

[英]Mapreduce Hadoop WordCount Example for JSON file

我正在學習Java和Hadoop,並且看到了無數簡單的txt文件的WordCount示例。 如何為下面的JSON文件應用此WordCount示例? 我在專門讀取Mapper的每個JSON對象的每一行時遇到了麻煩。

file.json:

[
 {
  "id": 124,
  "tweet": "Hey its a beautiful day today!"
  "user": "twitter_username101"
 },
 {
  "id": 433,
  "tweet": "The worst superbowl was this year's for sure, waste of my day",
  "user": "username23"
 }
]

您可以使用jsonReader,然后通過迭代將單詞計數應用於對象列表。 傑森閱讀器

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM