背景:ストリーミングAPIからのテキストをテキストファイルに集め、json.orgライブラリを使用して各行をJavaオブジェクトに正常に解析しました。すばらしいです。Java json例外付き。
問題:「テキスト」から:-field私は情報を抽出したいと思っていますが、これは半完成です。 、私のテキストファイルで、これがある場所を特定しようとすると
org.json.JSONException: Expected a ',' or '}' at 1280 [character 1281 line 1]
私は通常の文字を見るとlibをはjson.org考え方と、理由です、行うことになっているものが行われます。しかし私は、私のコードを実行し、この例外を得るのですか私はこれを得ていますか?私はどこから始めるのですか?
これは私のファイルの1280行目です。文字1281は 'o'なので、私は何が間違っているのか分かりません。
{ "retweet_count":ヌル、 "テキスト": "@Grooveshark上プリテンダーズによって誤解しないでくださいに耳を傾けます。http:\/\/tinysong.com \/o9ui #musicmonday #nowplaying"、 "id_str": "28756412823"、 "entities":{"urls":[{"index":[63,87]、 "expanded_url":null、 "url": "http:\/\/tinysong.com \ "インデックス": "インデックス": "インデックス": "テキスト": "現在再生中"、 "インデックス":[101,112]}、 "user_mentions ";" {"id_str": "3806441"、 "indices":[49,61]、 "screen_name": "Grooveshark"、 "name": "Grooveshark"、 "id":3806441}]} null "、" place ":null、" geo ":null、" new_id_str ":" 608552371148029952 "、" source ":" web "、" new_id ":608552371148029952、" null "、" retweeted ":false、" in_reply_to_status_id " in_reply_to_user_id_str ":null、" created_at ":" Tue Oct 26 03:40:05 +0000 2010 "、" contributors ":null、"使用しないでください: "、"切り捨て ":false、" in_reply_to_status_id_str ":null、" favorited ":false、" in_reply_to_user_id_str " r ":{" follow_request_sent ":null、" lang ":" en "、" time_zone ":" La Paz "、" id_str ":" 24490174 "、" following ":null、" profile_text_color ":" 666666 " 「profile_link_color」:「3399CC」、「description」:「私は、「followers_count」:466、「profile_background_image_url」:「http:\/\/a3.twimg.com \/profile_background_images \/113185343 \ /x0f8a90fc4af7484f7a0c6c11d594f94.png」、複雑な存在。若干のナルディとソーシャルスキルのあるオタクが、聞こえるかもしれないほどです。アクティブなゲーマー。音楽、映画、本、食べ物の恋人。 "、" listing_count ":18、"通知 ":null、" profile_background_tile ":true、" statuses_count ":17095、" profile_sidebar_fill_color ":" 202020 "、" profile_image_url ":" http:\/\/a0.twimg.com "、" profile_use_background_image ":false、" contributors_enabled ":false、" friends_count ":339、" profile_sidebar_border_color ":"/profile_images \/1117295836 \ /geekydot2_normal.jpg "、"場所 ":"ドミニカ共和国 "、" show_all_inline_media " "" 3月15日05:06:39 +0000 2009 "、"名前 ":" Ligia Carri \ "、" " 0、 "url": "http:\/\/geekydot.wordpress.com \ /"、 "id":24490174、 "verified":false、 "utc_offset": - 14400、 "profile_background_color" ":" 202020 "}、" in_reply_to_screen_name ":ヌル、" in_reply_to_user_id ":ヌル、" ID」:28756412823}
、ここで同じことを、フォーマットされます:
{
"retweet_count": null,
"text": "Listening to Don't Get Me Wrong by Pretenders on @Grooveshark: http:\/\/tinysong.com\/o9ui #musicmonday #nowplaying",
"id_str": "28756412823",
"entities": {
"urls": [
{
"indices": [
63,
87
],
"expanded_url": null,
"url": "http:\/\/tinysong.com\/o9ui"
}
],
"hashtags": [
{
"text": "musicmonday",
"indices": [
88,
100
]
},
{
"text": "nowplaying",
"indices": [
101,
112
]
}
],
"user_mentions": [
{
"id_str": "3806441",
"indices": [
49,
61
],
"screen_name": "Grooveshark",
"name": "Grooveshark",
"id": 3806441
}
]
},
"coordinates": null,
"retweeted": false,
"in_reply_to_status_id": null,
"place": null,
"geo": null,
"new_id_str": "608552371148029952",
"source": "web",
"new_id": 608552371148029952,
"truncated": false,
"in_reply_to_status_id_str": null,
"favorited": false,
"in_reply_to_user_id_str": null,
"created_at": "Tue Oct 26 03:40:05 +0000 2010",
"contributors": null,
"user": {
"follow_request_sent": null,
"lang": "en",
"time_zone": "La Paz",
"id_str": "24490174",
"following": null,
"profile_text_color": "666666",
"followers_count": 466,
"profile_background_image_url": "http:\/\/a3.twimg.com\/profile_background_images\/113185343\/x0f8a90fc4af7484f7a0c6c11d594f94.png",
"profile_link_color": "3399CC",
"description": "I'm a complex being. A bit of a nerd and a geek with social skills, as unlikely as that may sound. Active gamer. Lover of music, movies, books and food. ",
"listed_count": 18,
"notifications": null,
"profile_background_tile": true,
"statuses_count": 17095,
"profile_sidebar_fill_color": "202020",
"profile_image_url": "http:\/\/a0.twimg.com\/profile_images\/1117295836\/geekydot2_normal.jpg",
"location": "Dominican Republic",
"show_all_inline_media": false,
"profile_use_background_image": false,
"contributors_enabled": false,
"friends_count": 339,
"profile_sidebar_border_color": "666666",
"protected": false,
"screen_name": "dotina",
"geo_enabled": false,
"created_at": "Sun Mar 15 05:06:39 +0000 2009",
"name": "Ligia Carri\u00f3n",
"favourites_count": 0,
"url": "http:\/\/geekydot.wordpress.com\/",
"id": 24490174,
"verified": false,
"utc_offset": -14400,
"profile_background_color": "202020"
},
"in_reply_to_screen_name": null,
"in_reply_to_user_id": null,
"id": 28756412823
}
まず、JSONのものを削除して、それをもっと小さくすることから始めます。エラーを特定して孤立させるには、エラーの原因となるセクションのみを削除したら、ここであなたの投稿を更新します。 – willcodejavaforfood
twitterレスポンスを解析するのにどのJSONを使用していますか?また、あなたはどんなツイッターAPIを使用していますか? –
@TEG:http://www.json.org/java/indexのライブラリを使用しています。html私はものを取り除くことを検討するつもりですが、私はつぶやきの部分の非常に基本的な抽出と分析のために〜20K行のテキストファイルで作業しています。 – oalmgren