如何使用jackson库在json中阅读twitter feed

时间:2014-02-21 23:52:17

标签: java json jackson

我正在尝试通过解析以下格式的JSON文件来创建jNODE对象:

{"delete":{"status":{"id":222318827684372480,"user_id":372364809,"id_str":"222318827684372480","user_id_str":"372364809"}}}
{"delete":{"status":{"id":430870775227117568,"user_id":582666020,"id_str":"430870775227117568","user_id_str":"582666020"}}}
{"delete":{"status":{"id":217335495406010368,"user_id":418026096,"id_str":"217335495406010368","user_id_str":"418026096"}}}

创建jNODE对象时,我得到的对象是:

{"delete":{"status":{"id":222318827684372480,"user_id":372364809,"id_str":"222318827684372480","user_id_str":"372364809"}}}

而不是JSON文件中的两个块的其余部分。任何人都可以帮忙吗? 我们试图使用迭代器来旅行,但它没有用。感谢。

1 个答案:

答案 0 :(得分:0)

尝试将twitter Feed封装在一个数组中,它可以解析多行: [ { “删除”:{ “地位”:{ “ID”:222318827684372480, “USER_ID”:372364809, “ID_STR”: “222318827684372480”, “user_id_str”: “372364809”}}} , { “删除”:{ “地位”:{ “ID”:222318827684372480, “USER_ID”:372364809, “ID_STR”: “222318827684372480”, “user_id_str”: “372364809”}}} , { “删除”:{ “地位”:{ “ID”:222318827684372480, “USER_ID”:372364809, “ID_STR”: “222318827684372480”, “user_id_str”: “372364809”}}} ]