├── .classpath ├── .gitignore ├── .idea ├── .name ├── ant.xml ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── libraries │ └── libs.xml ├── misc.xml ├── modules.xml ├── uiDesigner.xml └── vcs.xml ├── .project ├── AndroidManifest.xml ├── Json-android-compare.iml ├── README.md ├── assets └── public_timeline.json ├── build.properties ├── build.xml ├── gen └── com │ └── martinadamek │ └── jsonandroid │ └── R.java ├── libs ├── gson-2.2.4.jar ├── jackson-core-2.3.0.jar ├── json-smart-1.1.1.jar └── json_simple-1.1.jar ├── local.properties ├── proguard.cfg ├── project.properties ├── res ├── drawable-hdpi │ └── icon.png ├── drawable-ldpi │ └── icon.png ├── drawable-mdpi │ └── icon.png ├── layout │ └── main.xml └── values │ └── strings.xml ├── screenshots └── android_json_compare_1.png └── src └── com └── martinadamek └── jsonandroid ├── AndroidJson.java ├── GsonJson.java ├── JacksonJson.java ├── MainActivity.java ├── ResultsContainer.java ├── SimpleJson.java ├── SmartJson.java ├── StringUtils.java └── TestJson.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | 10 | # Packages # 11 | ############ 12 | # it's better to unpack these files and commit the raw source 13 | # git has its own built in compression methods 14 | *.7z 15 | *.dmg 16 | *.gz 17 | *.iso 18 | #*.jar 19 | *.rar 20 | *.tar 21 | *.zip 22 | 23 | # Logs and databases # 24 | ###################### 25 | *.log 26 | *.sql 27 | *.sqlite 28 | 29 | # OS generated files # 30 | ###################### 31 | .DS_Store? 32 | ehthumbs.db 33 | Icon? 34 | Thumbs.db 35 | 36 | # android/idea 37 | out 38 | 39 | .idea/workspace.xml 40 | 41 | /gen 42 | /bin 43 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | json-android-compare -------------------------------------------------------------------------------- /.idea/ant.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/libraries/libs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 26 | 27 | http://www.w3.org/1999/xhtml 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/uiDesigner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | JSON Android Compare 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Json-android-compare.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This is Android demo project used to compare performance of various JSON parser implementations in my blog post. 2 | 3 | Right now it includes: 4 | 5 | * Android built-in: [link](http://developer.android.com/reference/org/json/package-summary.html) 6 | * JSON.simple: [link](http://code.google.com/p/json-simple/) 7 | * JSON.smart: [link](http://code.google.com/p/json-smart/) 8 | * Jackson: [link](http://jackson.codehaus.org/) 9 | * Gson: [link](http://code.google.com/p/google-gson/) 10 | 11 | Results on my Nexus One and more information is available in my blog post at [http://martinadamek.com](http://martinadamek.com) 12 | 13 | --- 14 | 15 | Screenshot: 16 | 17 | ![screenshot](https://github.com/alt236/json-android-compare/raw/master/screenshots/android_json_compare_1.png) -------------------------------------------------------------------------------- /assets/public_timeline.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "text":"Whn IGet Ah Car Ima Love Life.", 4 | "in_reply_to_screen_name":null, 5 | "in_reply_to_status_id":null, 6 | "place":null, 7 | "in_reply_to_user_id":null, 8 | "retweeted":false, 9 | "source":"web", 10 | "id_str":"32188907760128000", 11 | "in_reply_to_status_id_str":null, 12 | "geo":null, 13 | "contributors":null, 14 | "in_reply_to_user_id_str":null, 15 | "retweet_count":0, 16 | "truncated":false, 17 | "coordinates":null, 18 | "user":{ 19 | "profile_sidebar_fill_color":"", 20 | "url":null, 21 | "profile_background_tile":true, 22 | "time_zone":"Central Time (US & Canada)", 23 | "description":"IMake Decisions With My Heart.. IDeal With Pain By Laughin, Drinkin, And Lettin It Go.. Life Goes On.", 24 | "listed_count":0, 25 | "following":null, 26 | "verified":false, 27 | "friends_count":91, 28 | "followers_count":177, 29 | "location":"", 30 | "profile_link_color":"0084B4", 31 | "profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/1224851279\/july_5922_normal.jpg", 32 | "favourites_count":3, 33 | "profile_sidebar_border_color":"BDDCAD", 34 | "id_str":"205423565", 35 | "screen_name":"ForeverAjee", 36 | "is_translator":false, 37 | "contributors_enabled":false, 38 | "profile_use_background_image":true, 39 | "notifications":null, 40 | "profile_background_color":"9AE4E8", 41 | "protected":false, 42 | "show_all_inline_media":false, 43 | "geo_enabled":false, 44 | "profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/199590544\/cassie2.jpg", 45 | "name":"Queen_Ajee", 46 | "follow_request_sent":null, 47 | "statuses_count":4423, 48 | "id":205423565, 49 | "lang":"en", 50 | "utc_offset":-21600, 51 | "created_at":"Wed Oct 20 21:21:13 +0000 2010", 52 | "profile_text_color":"333333" 53 | }, 54 | "id":32188907760128000, 55 | "favorited":false, 56 | "created_at":"Mon Jan 31 21:30:08 +0000 2011" 57 | }, 58 | { 59 | "text":"\u041a\u0430\u043a \u043e\u043f\u0443\u0441\u0442\u043e\u0448\u0438\u0442\u044c \u043e\u0437\u0435\u0440\u043e \u0437\u0430 15 \u043c\u0438\u043d\u0443\u0442? (4 \u0444\u043e\u0442\u043e http:\/\/ivit.info\/foto\/9292-.html #ivit_info", 60 | "in_reply_to_screen_name":null, 61 | "in_reply_to_status_id":null, 62 | "place":null, 63 | "in_reply_to_user_id":null, 64 | "retweeted":false, 65 | "source":"\u003Ca href=\"http:\/\/ivit.info\" rel=\"nofollow\"\u003Eivit_bot3\u003C\/a\u003E", 66 | "id_str":"32188905553920000", 67 | "in_reply_to_status_id_str":null, 68 | "geo":null, 69 | "contributors":null, 70 | "in_reply_to_user_id_str":null, 71 | "retweet_count":0, 72 | "truncated":false, 73 | "coordinates":null, 74 | "user":{ 75 | "is_translator":false, 76 | "show_all_inline_media":false, 77 | "geo_enabled":false, 78 | "friends_count":1965, 79 | "profile_sidebar_fill_color":"DDEEF6", 80 | "url":null, 81 | "statuses_count":12012, 82 | "profile_background_tile":false, 83 | "time_zone":null, 84 | "description":null, 85 | "following":null, 86 | "followers_count":517, 87 | "location":null, 88 | "contributors_enabled":false, 89 | "profile_link_color":"0084B4", 90 | "profile_image_url":"http:\/\/a3.twimg.com\/sticky\/default_profile_images\/default_profile_2_normal.png", 91 | "favourites_count":0, 92 | "profile_sidebar_border_color":"C0DEED", 93 | "id_str":"156994182", 94 | "follow_request_sent":null, 95 | "verified":false, 96 | "screen_name":"ivit_mirror2", 97 | "profile_use_background_image":true, 98 | "notifications":null, 99 | "profile_background_color":"C0DEED", 100 | "protected":false, 101 | "profile_background_image_url":"http:\/\/a3.twimg.com\/a\/1296265969\/images\/themes\/theme1\/bg.png", 102 | "name":"ivit_mirror2", 103 | "listed_count":19, 104 | "id":156994182, 105 | "lang":"en", 106 | "utc_offset":null, 107 | "created_at":"Fri Jun 18 14:38:49 +0000 2010", 108 | "profile_text_color":"333333" 109 | }, 110 | "id":32188905553920000, 111 | "favorited":false, 112 | "created_at":"Mon Jan 31 21:30:07 +0000 2011" 113 | }, 114 | { 115 | "text":"Celexa (Citalopram) 20mg http:\/\/page2rss.com\/\/caa5e5aae1651e05173332a7e73fc6d1\/5306809_5307108\/celexa-citalopram-mg", 116 | "in_reply_to_screen_name":null, 117 | "in_reply_to_status_id":null, 118 | "place":null, 119 | "in_reply_to_user_id":null, 120 | "retweeted":false, 121 | "source":"\u003Ca href=\"http:\/\/page2rss.com\/\" rel=\"nofollow\"\u003EPage2RSS\u003C\/a\u003E", 122 | "id_str":"32188903981056000", 123 | "in_reply_to_status_id_str":null, 124 | "geo":null, 125 | "contributors":null, 126 | "in_reply_to_user_id_str":null, 127 | "retweet_count":0, 128 | "truncated":false, 129 | "coordinates":null, 130 | "user":{ 131 | "verified":false, 132 | "profile_sidebar_fill_color":"252429", 133 | "url":"http:\/\/www.unidrugs.net\/", 134 | "contributors_enabled":false, 135 | "profile_background_tile":true, 136 | "time_zone":"Greenland", 137 | "description":"Uni Drugs MedStore - CHEAP No Prescription Drugs - CIALIS KAMAGRA LEVITRA VIAGRA", 138 | "listed_count":1, 139 | "following":null, 140 | "followers_count":188, 141 | "location":"No Prescription Drugs Online", 142 | "profile_link_color":"2FC2EF", 143 | "profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/1191189246\/title_what_normal.gif", 144 | "is_translator":false, 145 | "favourites_count":0, 146 | "friends_count":183, 147 | "profile_sidebar_border_color":"181A1E", 148 | "id_str":"98020812", 149 | "screen_name":"UniDrugs", 150 | "profile_use_background_image":true, 151 | "statuses_count":26262, 152 | "notifications":null, 153 | "profile_background_color":"1A1B1F", 154 | "protected":false, 155 | "show_all_inline_media":false, 156 | "profile_background_image_url":"http:\/\/a1.twimg.com\/profile_background_images\/60815103\/header.png", 157 | "name":"No Prescription Drug", 158 | "follow_request_sent":null, 159 | "geo_enabled":false, 160 | "id":98020812, 161 | "lang":"en", 162 | "utc_offset":-10800, 163 | "created_at":"Sun Dec 20 01:33:07 +0000 2009", 164 | "profile_text_color":"666666" 165 | }, 166 | "id":32188903981056000, 167 | "favorited":false, 168 | "created_at":"Mon Jan 31 21:30:07 +0000 2011" 169 | }, 170 | { 171 | "text":"Interesing article on the OSU page http:\/\/oregonstate.edu\/ua\/ncs\/archives\/2011\/jan\/gender-and-hygiene-could-cleanliness-be-hurting-girls", 172 | "in_reply_to_screen_name":null, 173 | "in_reply_to_status_id":null, 174 | "place":null, 175 | "in_reply_to_user_id":null, 176 | "retweeted":false, 177 | "source":"web", 178 | "id_str":"32188902932480000", 179 | "in_reply_to_status_id_str":null, 180 | "geo":null, 181 | "contributors":null, 182 | "in_reply_to_user_id_str":null, 183 | "retweet_count":0, 184 | "truncated":false, 185 | "coordinates":null, 186 | "user":{ 187 | "is_translator":false, 188 | "profile_sidebar_fill_color":"DDEEF6", 189 | "url":null, 190 | "verified":false, 191 | "profile_background_tile":false, 192 | "time_zone":null, 193 | "description":null, 194 | "following":null, 195 | "followers_count":2, 196 | "location":null, 197 | "follow_request_sent":null, 198 | "profile_link_color":"0084B4", 199 | "profile_image_url":"http:\/\/a0.twimg.com\/sticky\/default_profile_images\/default_profile_3_normal.png", 200 | "contributors_enabled":false, 201 | "favourites_count":0, 202 | "profile_sidebar_border_color":"C0DEED", 203 | "id_str":"235872290", 204 | "screen_name":"BeauReeves", 205 | "profile_use_background_image":true, 206 | "show_all_inline_media":false, 207 | "listed_count":1, 208 | "geo_enabled":false, 209 | "notifications":null, 210 | "profile_background_color":"C0DEED", 211 | "protected":false, 212 | "statuses_count":14, 213 | "profile_background_image_url":"http:\/\/a3.twimg.com\/a\/1296099941\/images\/themes\/theme1\/bg.png", 214 | "name":"Cortney Elliott", 215 | "friends_count":5, 216 | "id":235872290, 217 | "lang":"en", 218 | "utc_offset":null, 219 | "created_at":"Sun Jan 09 07:56:30 +0000 2011", 220 | "profile_text_color":"333333" 221 | }, 222 | "id":32188902932480000, 223 | "favorited":false, 224 | "created_at":"Mon Jan 31 21:30:07 +0000 2011" 225 | }, 226 | { 227 | "text":"....Every time im in the club and this song comes on, girls rush me http:\/\/www.youtube.com\/watch?v=Ac64vNkk6Ks ...no lie", 228 | "in_reply_to_screen_name":null, 229 | "in_reply_to_status_id":null, 230 | "place":null, 231 | "in_reply_to_user_id":null, 232 | "retweeted":false, 233 | "source":"web", 234 | "id_str":"32188898847232000", 235 | "in_reply_to_status_id_str":null, 236 | "geo":null, 237 | "contributors":null, 238 | "in_reply_to_user_id_str":null, 239 | "retweet_count":0, 240 | "truncated":false, 241 | "coordinates":null, 242 | "user":{ 243 | "is_translator":false, 244 | "friends_count":199, 245 | "profile_sidebar_fill_color":"252429", 246 | "url":null, 247 | "profile_background_tile":false, 248 | "time_zone":"Mountain Time (US & Canada)", 249 | "description":"I inhaled a chemical substance that put me to sleep in 1311. Slept for 700yrs and woke up in 2011. My point is... ", 250 | "following":null, 251 | "followers_count":263, 252 | "location":"Still in the Chemical Lab", 253 | "statuses_count":4488, 254 | "profile_link_color":"2FC2EF", 255 | "profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1227546014\/x2_37b5ca0_normal.jpeg", 256 | "favourites_count":12, 257 | "profile_sidebar_border_color":"181A1E", 258 | "id_str":"206762057", 259 | "follow_request_sent":null, 260 | "screen_name":"neosoul_poetry", 261 | "profile_use_background_image":true, 262 | "verified":false, 263 | "notifications":null, 264 | "profile_background_color":"1A1B1F", 265 | "protected":false, 266 | "show_all_inline_media":false, 267 | "contributors_enabled":false, 268 | "profile_background_image_url":"http:\/\/a3.twimg.com\/a\/1296156503\/images\/themes\/theme9\/bg.gif", 269 | "name":"Chemistry's Soul Bro", 270 | "listed_count":6, 271 | "geo_enabled":false, 272 | "id":206762057, 273 | "lang":"en", 274 | "utc_offset":-25200, 275 | "created_at":"Sat Oct 23 17:17:44 +0000 2010", 276 | "profile_text_color":"666666" 277 | }, 278 | "id":32188898847232000, 279 | "favorited":false, 280 | "created_at":"Mon Jan 31 21:30:06 +0000 2011" 281 | }, 282 | { 283 | "text":"well............................YEEESSSSSSSSSSSS. \u2014 i can't choose:\/ http:\/\/4ms.me\/efKJj8", 284 | "in_reply_to_screen_name":null, 285 | "in_reply_to_status_id":null, 286 | "place":null, 287 | "in_reply_to_user_id":null, 288 | "retweeted":false, 289 | "source":"\u003Ca href=\"http:\/\/formspring.me\" rel=\"nofollow\"\u003EFormspring.me\u003C\/a\u003E", 290 | "id_str":"32188897383424000", 291 | "in_reply_to_status_id_str":null, 292 | "geo":null, 293 | "contributors":null, 294 | "in_reply_to_user_id_str":null, 295 | "retweet_count":0, 296 | "truncated":false, 297 | "coordinates":null, 298 | "user":{ 299 | "verified":false, 300 | "profile_sidebar_fill_color":"c9c9c9", 301 | "url":null, 302 | "profile_background_tile":true, 303 | "time_zone":null, 304 | "description":"im 13 and i love nathan sykes, end of story.", 305 | "is_translator":false, 306 | "contributors_enabled":false, 307 | "following":null, 308 | "followers_count":66, 309 | "location":"", 310 | "profile_link_color":"e6104d", 311 | "profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1222601502\/031407_normal.jpg", 312 | "favourites_count":0, 313 | "profile_sidebar_border_color":"bfbfbf", 314 | "id_str":"208284899", 315 | "follow_request_sent":null, 316 | "screen_name":"lucysykesxD", 317 | "show_all_inline_media":false, 318 | "geo_enabled":false, 319 | "profile_use_background_image":true, 320 | "statuses_count":645, 321 | "notifications":null, 322 | "profile_background_color":"07090b", 323 | "protected":false, 324 | "profile_background_image_url":"http:\/\/a2.twimg.com\/profile_background_images\/182773722\/x6a3ea21af284dee8d4147c29c719e40.png", 325 | "name":"lucyellenwilson.", 326 | "listed_count":0, 327 | "friends_count":420, 328 | "id":208284899, 329 | "lang":"en", 330 | "utc_offset":null, 331 | "created_at":"Wed Oct 27 00:31:55 +0000 2010", 332 | "profile_text_color":"1c1f23" 333 | }, 334 | "id":32188897383424000, 335 | "favorited":false, 336 | "created_at":"Mon Jan 31 21:30:05 +0000 2011" 337 | }, 338 | { 339 | "text":"Payla\u015f\u0131mlar B\u015flam\u0131\u015ft\u0131r... ;)", 340 | "in_reply_to_screen_name":null, 341 | "in_reply_to_status_id":null, 342 | "place":null, 343 | "in_reply_to_user_id":null, 344 | "retweeted":false, 345 | "source":"\u003Ca href=\"http:\/\/www.facebook.com\/twitter\" rel=\"nofollow\"\u003EFacebook\u003C\/a\u003E", 346 | "id_str":"32188894237696000", 347 | "in_reply_to_status_id_str":null, 348 | "geo":null, 349 | "contributors":null, 350 | "in_reply_to_user_id_str":null, 351 | "retweet_count":0, 352 | "truncated":false, 353 | "coordinates":null, 354 | "user":{ 355 | "show_all_inline_media":false, 356 | "geo_enabled":false, 357 | "profile_sidebar_fill_color":"F6F6F6", 358 | "url":null, 359 | "follow_request_sent":false, 360 | "statuses_count":455, 361 | "profile_background_tile":false, 362 | "time_zone":null, 363 | "description":"", 364 | "following":false, 365 | "followers_count":0, 366 | "location":"", 367 | "profile_link_color":"038543", 368 | "profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/1098936715\/CA47PBUU_normal.jpg", 369 | "favourites_count":0, 370 | "profile_sidebar_border_color":"EEEEEE", 371 | "id_str":"176355718", 372 | "listed_count":0, 373 | "verified":false, 374 | "friends_count":0, 375 | "screen_name":"mertozengin", 376 | "profile_use_background_image":true, 377 | "notifications":false, 378 | "profile_background_color":"ACDED6", 379 | "protected":false, 380 | "profile_background_image_url":"http:\/\/a2.twimg.com\/a\/1295982098\/images\/themes\/theme18\/bg.gif", 381 | "name":"mert zengin", 382 | "is_translator":false, 383 | "contributors_enabled":false, 384 | "id":176355718, 385 | "lang":"en", 386 | "utc_offset":null, 387 | "created_at":"Mon Aug 09 09:14:24 +0000 2010", 388 | "profile_text_color":"333333" 389 | }, 390 | "id":32188894237696000, 391 | "favorited":false, 392 | "created_at":"Mon Jan 31 21:30:05 +0000 2011" 393 | }, 394 | { 395 | "text":"Huh man RT @cash_money_1800 Old skool ran it to me he told me even when ya bread low nigga never keep ya head (cont) http:\/\/tl.gd\/8h18sa", 396 | "in_reply_to_screen_name":null, 397 | "in_reply_to_status_id":null, 398 | "place":null, 399 | "in_reply_to_user_id":null, 400 | "retweeted":false, 401 | "source":"\u003Ca href=\"http:\/\/twidroyd.com\" rel=\"nofollow\"\u003Etwidroyd\u003C\/a\u003E", 402 | "id_str":"32188892971008000", 403 | "in_reply_to_status_id_str":null, 404 | "geo":null, 405 | "contributors":null, 406 | "in_reply_to_user_id_str":null, 407 | "retweet_count":0, 408 | "truncated":false, 409 | "coordinates":null, 410 | "user":{ 411 | "listed_count":1, 412 | "profile_sidebar_fill_color":"efefef", 413 | "url":null, 414 | "profile_background_tile":true, 415 | "time_zone":"Quito", 416 | "description":"", 417 | "following":null, 418 | "verified":false, 419 | "friends_count":144, 420 | "followers_count":197, 421 | "location":"Slowneck ave", 422 | "profile_link_color":"009999", 423 | "profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/1211996905\/young_nice_normal.jpg", 424 | "is_translator":false, 425 | "favourites_count":4, 426 | "profile_sidebar_border_color":"eeeeee", 427 | "id_str":"123096473", 428 | "screen_name":"nicemoneysigns", 429 | "contributors_enabled":false, 430 | "profile_use_background_image":true, 431 | "follow_request_sent":null, 432 | "notifications":null, 433 | "profile_background_color":"131516", 434 | "protected":false, 435 | "show_all_inline_media":false, 436 | "geo_enabled":false, 437 | "profile_background_image_url":"http:\/\/a2.twimg.com\/a\/1296265969\/images\/themes\/theme14\/bg.gif", 438 | "name":"Darian", 439 | "statuses_count":5267, 440 | "id":123096473, 441 | "lang":"en", 442 | "utc_offset":-18000, 443 | "created_at":"Mon Mar 15 00:17:24 +0000 2010", 444 | "profile_text_color":"333333" 445 | }, 446 | "id":32188892971008000, 447 | "favorited":false, 448 | "created_at":"Mon Jan 31 21:30:04 +0000 2011" 449 | }, 450 | { 451 | "text":"Ocio==> Gratis Busca y encuentra videos Divertidos You Tube sin acceder http:\/\/bit.ly\/aYlwyX", 452 | "in_reply_to_screen_name":null, 453 | "in_reply_to_status_id":null, 454 | "place":null, 455 | "in_reply_to_user_id":null, 456 | "retweeted":false, 457 | "source":"\u003Ca href=\"http:\/\/cascada.site88.net\/ACT\/index.html\" rel=\"nofollow\"\u003EAuto Creador de Tweets \u003C\/a\u003E", 458 | "id_str":"32188889934336000", 459 | "in_reply_to_status_id_str":null, 460 | "geo":null, 461 | "contributors":null, 462 | "in_reply_to_user_id_str":null, 463 | "retweet_count":0, 464 | "truncated":false, 465 | "coordinates":null, 466 | "user":{ 467 | "is_translator":false, 468 | "contributors_enabled":false, 469 | "profile_sidebar_fill_color":"DDEEF6", 470 | "url":"http:\/\/www.crear-negocios.com", 471 | "profile_background_tile":false, 472 | "time_zone":"Greenland", 473 | "description":"Apoyando emprendedores con negocios en internet, ventas, marketing, seo, dise\u00f1o web, dise\u00f1o grafico. productos digitales", 474 | "following":null, 475 | "followers_count":776, 476 | "location":"Madrid", 477 | "follow_request_sent":null, 478 | "profile_link_color":"0084B4", 479 | "profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/1198004562\/pieppal_normal.jpg", 480 | "show_all_inline_media":false, 481 | "geo_enabled":false, 482 | "favourites_count":0, 483 | "profile_sidebar_border_color":"C0DEED", 484 | "id_str":"96700064", 485 | "statuses_count":31759, 486 | "screen_name":"crearnegocios", 487 | "profile_use_background_image":true, 488 | "listed_count":8, 489 | "notifications":null, 490 | "friends_count":712, 491 | "profile_background_color":"C0DEED", 492 | "protected":false, 493 | "profile_background_image_url":"http:\/\/a3.twimg.com\/a\/1296179758\/images\/themes\/theme1\/bg.png", 494 | "name":"Arlex Molina", 495 | "verified":false, 496 | "id":96700064, 497 | "lang":"es", 498 | "utc_offset":-10800, 499 | "created_at":"Mon Dec 14 05:16:19 +0000 2009", 500 | "profile_text_color":"333333" 501 | }, 502 | "id":32188889934336000, 503 | "favorited":false, 504 | "created_at":"Mon Jan 31 21:30:04 +0000 2011" 505 | }, 506 | { 507 | "in_reply_to_screen_name":null, 508 | "in_reply_to_status_id":null, 509 | "place":null, 510 | "in_reply_to_user_id":null, 511 | "retweeted":false, 512 | "id_str":"32188889825280000", 513 | "source":"web", 514 | "in_reply_to_status_id_str":null, 515 | "geo":null, 516 | "contributors":null, 517 | "in_reply_to_user_id_str":null, 518 | "retweet_count":0, 519 | "truncated":false, 520 | "coordinates":null, 521 | "user":{ 522 | "profile_background_tile":true, 523 | "time_zone":null, 524 | "description":"Interagir \u00e9 uma coisa maravilhosa!!! Adoro falar, aprender, ver coisas novas o tempo todo! E a\u00ed, a gente divide com a galera por aqui! =D", 525 | "following":null, 526 | "verified":false, 527 | "followers_count":68, 528 | "location":"Brasil", 529 | "profile_link_color":"F8D605", 530 | "profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/732464470\/ANNA_RACHEL_CARICATURA_normal.jpg", 531 | "is_translator":false, 532 | "contributors_enabled":false, 533 | "favourites_count":0, 534 | "profile_sidebar_border_color":"F8D605", 535 | "id_str":"119838029", 536 | "screen_name":"arachelferreira", 537 | "profile_use_background_image":true, 538 | "follow_request_sent":null, 539 | "notifications":null, 540 | "profile_background_color":"000000", 541 | "show_all_inline_media":false, 542 | "geo_enabled":false, 543 | "profile_background_image_url":"http:\/\/a2.twimg.com\/profile_background_images\/84123578\/Lu_de_Mari_1.jpg", 544 | "protected":false, 545 | "statuses_count":535, 546 | "name":"Anna Rachel Ferreira", 547 | "lang":"en", 548 | "created_at":"Thu Mar 04 20:01:58 +0000 2010", 549 | "profile_text_color":"333333", 550 | "id":119838029, 551 | "listed_count":4, 552 | "utc_offset":null, 553 | "friends_count":72, 554 | "profile_sidebar_fill_color":"FD0B71", 555 | "url":"http:\/\/www.annarachel-impressoes.blogspot.com" 556 | }, 557 | "favorited":false, 558 | "id":32188889825280000, 559 | "created_at":"Mon Jan 31 21:30:04 +0000 2011", 560 | "text":"Quem s\u00e3o os monarcas sen\u00e3o seres humanos com uma carga pesad\u00edssima a carregar? \"O Discurso do Rei\" lembra a humanidade da Coroa brit\u00e2nica" 561 | }, 562 | { 563 | "text":"Make yourself a #Crochet cap @YouTube - http:\/\/ow.ly\/3NBhN", 564 | "in_reply_to_screen_name":null, 565 | "in_reply_to_status_id":null, 566 | "place":null, 567 | "in_reply_to_user_id":null, 568 | "retweeted":false, 569 | "source":"\u003Ca href=\"http:\/\/www.hootsuite.com\" rel=\"nofollow\"\u003EHootSuite\u003C\/a\u003E", 570 | "id_str":"32188889519104000", 571 | "in_reply_to_status_id_str":null, 572 | "geo":null, 573 | "contributors":null, 574 | "in_reply_to_user_id_str":null, 575 | "retweet_count":0, 576 | "truncated":false, 577 | "coordinates":null, 578 | "user":{ 579 | "contributors_enabled":false, 580 | "profile_sidebar_fill_color":"000c29", 581 | "url":"http:\/\/www.youtube.com\/crochet", 582 | "listed_count":0, 583 | "profile_background_tile":false, 584 | "time_zone":null, 585 | "description":"Crochet Guru", 586 | "following":null, 587 | "followers_count":37, 588 | "location":"Savannah Georgia", 589 | "friends_count":3, 590 | "profile_link_color":"784726", 591 | "profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1176781882\/cupcake_normal.jpg", 592 | "favourites_count":0, 593 | "profile_sidebar_border_color":"212535", 594 | "id_str":"220129089", 595 | "is_translator":false, 596 | "show_all_inline_media":false, 597 | "geo_enabled":false, 598 | "screen_name":"CrochetGeek", 599 | "statuses_count":682, 600 | "profile_use_background_image":false, 601 | "notifications":null, 602 | "profile_background_color":"31343d", 603 | "protected":false, 604 | "follow_request_sent":null, 605 | "profile_background_image_url":"http:\/\/a1.twimg.com\/profile_background_images\/175753393\/x0f7fc6e815be05ce5cdd7ab33758383.jpg", 606 | "name":"Teresa Crochet", 607 | "id":220129089, 608 | "lang":"en", 609 | "verified":false, 610 | "utc_offset":null, 611 | "created_at":"Fri Nov 26 21:33:30 +0000 2010", 612 | "profile_text_color":"323e4c" 613 | }, 614 | "id":32188889519104000, 615 | "favorited":false, 616 | "created_at":"Mon Jan 31 21:30:03 +0000 2011" 617 | }, 618 | { 619 | "text":"Omw 2 da crib", 620 | "in_reply_to_screen_name":null, 621 | "in_reply_to_status_id":null, 622 | "place":null, 623 | "in_reply_to_user_id":null, 624 | "retweeted":false, 625 | "source":"\u003Ca href=\"http:\/\/blackberry.com\/twitter\" rel=\"nofollow\"\u003ETwitter for BlackBerry\u00ae\u003C\/a\u003E", 626 | "id_str":"32188887728128000", 627 | "in_reply_to_status_id_str":null, 628 | "geo":null, 629 | "contributors":null, 630 | "in_reply_to_user_id_str":null, 631 | "retweet_count":0, 632 | "truncated":false, 633 | "coordinates":null, 634 | "user":{ 635 | "profile_sidebar_fill_color":"DDEEF6", 636 | "url":null, 637 | "profile_background_tile":true, 638 | "time_zone":null, 639 | "description":"We born to lose but build to win\/\/\/\/\/\/\/ Cant buy luv cant hide hate 100% fact", 640 | "follow_request_sent":null, 641 | "following":null, 642 | "followers_count":152, 643 | "location":"EVERYWHERE!!!!!!", 644 | "show_all_inline_media":false, 645 | "geo_enabled":false, 646 | "profile_link_color":"0084B4", 647 | "profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1229359324\/IMG00039-20110129-1013_normal.jpg", 648 | "statuses_count":527, 649 | "favourites_count":0, 650 | "profile_sidebar_border_color":"C0DEED", 651 | "id_str":"228533094", 652 | "screen_name":"i_gottahave_her", 653 | "listed_count":5, 654 | "profile_use_background_image":true, 655 | "friends_count":130, 656 | "notifications":null, 657 | "profile_background_color":"C0DEED", 658 | "protected":false, 659 | "verified":false, 660 | "profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/183600070\/2002_paid_in_full_004.jpg", 661 | "name":"Carlos Rivera", 662 | "id":228533094, 663 | "is_translator":false, 664 | "contributors_enabled":false, 665 | "lang":"en", 666 | "utc_offset":null, 667 | "created_at":"Mon Dec 20 00:45:09 +0000 2010", 668 | "profile_text_color":"333333" 669 | }, 670 | "id":32188887728128000, 671 | "favorited":false, 672 | "created_at":"Mon Jan 31 21:30:03 +0000 2011" 673 | }, 674 | { 675 | "text":"Se hebben weer een mongol gevonde bij voetbalfans", 676 | "in_reply_to_screen_name":null, 677 | "in_reply_to_status_id":null, 678 | "place":null, 679 | "in_reply_to_user_id":null, 680 | "retweeted":false, 681 | "source":"\u003Ca href=\"http:\/\/blackberry.com\/twitter\" rel=\"nofollow\"\u003ETwitter for BlackBerry\u00ae\u003C\/a\u003E", 682 | "id_str":"32188882703360000", 683 | "in_reply_to_status_id_str":null, 684 | "geo":null, 685 | "contributors":null, 686 | "in_reply_to_user_id_str":null, 687 | "retweet_count":0, 688 | "truncated":false, 689 | "coordinates":null, 690 | "user":{ 691 | "profile_sidebar_fill_color":"DDEEF6", 692 | "url":null, 693 | "profile_background_tile":false, 694 | "time_zone":null, 695 | "description":"", 696 | "listed_count":0, 697 | "following":null, 698 | "followers_count":35, 699 | "location":"\u00dcT: 52.045802,4.360992", 700 | "profile_link_color":"0084B4", 701 | "profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/980815061\/ik_normal.jpg", 702 | "is_translator":false, 703 | "show_all_inline_media":false, 704 | "geo_enabled":false, 705 | "favourites_count":0, 706 | "friends_count":44, 707 | "profile_sidebar_border_color":"C0DEED", 708 | "id_str":"140401429", 709 | "statuses_count":514, 710 | "screen_name":"wendeltromp", 711 | "profile_use_background_image":true, 712 | "contributors_enabled":false, 713 | "notifications":null, 714 | "profile_background_color":"C0DEED", 715 | "protected":false, 716 | "profile_background_image_url":"http:\/\/a3.twimg.com\/a\/1296179758\/images\/themes\/theme1\/bg.png", 717 | "name":"wendel tromp", 718 | "follow_request_sent":null, 719 | "verified":false, 720 | "id":140401429, 721 | "lang":"en", 722 | "utc_offset":null, 723 | "created_at":"Wed May 05 11:52:44 +0000 2010", 724 | "profile_text_color":"333333" 725 | }, 726 | "id":32188882703360000, 727 | "favorited":false, 728 | "created_at":"Mon Jan 31 21:30:02 +0000 2011" 729 | }, 730 | { 731 | "text":"\u0411\u043e\u0435\u0432\u0438\u043a\u0438 \u0438 \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0432\u044b :: \u0411\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u044b\u0441\u0442\u0440\u0435\u043b \/ The Big Bang (\u0422\u043e\u043d\u0438 \u041a\u0440\u0430\u043d\u0442\u0446) [2010 \u0433., \u0431\u043e\u0435\u0432\u0438\u043a, \u0442\u0440\u0438\u043b\u043b\u0435\u0440, \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0432, DVDRip]... http:\/\/bit.ly\/eld8BJ", 732 | "in_reply_to_screen_name":null, 733 | "in_reply_to_status_id":null, 734 | "place":null, 735 | "in_reply_to_user_id":null, 736 | "retweeted":false, 737 | "source":"\u003Ca href=\"http:\/\/twitterfeed.com\" rel=\"nofollow\"\u003Etwitterfeed\u003C\/a\u003E", 738 | "id_str":"32188880081920000", 739 | "in_reply_to_status_id_str":null, 740 | "geo":null, 741 | "contributors":null, 742 | "in_reply_to_user_id_str":null, 743 | "retweet_count":0, 744 | "truncated":false, 745 | "coordinates":null, 746 | "user":{ 747 | "show_all_inline_media":false, 748 | "geo_enabled":true, 749 | "profile_sidebar_fill_color":"DDEEF6", 750 | "url":"http:\/\/rutracker.ru", 751 | "follow_request_sent":null, 752 | "statuses_count":1615, 753 | "profile_background_tile":false, 754 | "time_zone":"Moscow", 755 | "description":"", 756 | "following":null, 757 | "followers_count":68, 758 | "location":"Moskow", 759 | "profile_link_color":"0084B4", 760 | "profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1031766110\/P6276697_normal.jpg", 761 | "favourites_count":0, 762 | "profile_sidebar_border_color":"C0DEED", 763 | "id_str":"160277659", 764 | "listed_count":4, 765 | "verified":false, 766 | "friends_count":0, 767 | "screen_name":"olegvv", 768 | "profile_use_background_image":true, 769 | "notifications":null, 770 | "profile_background_color":"C0DEED", 771 | "protected":false, 772 | "profile_background_image_url":"http:\/\/a3.twimg.com\/a\/1296156503\/images\/themes\/theme1\/bg.png", 773 | "name":"Oleg Volkov", 774 | "is_translator":false, 775 | "contributors_enabled":false, 776 | "id":160277659, 777 | "lang":"en", 778 | "utc_offset":10800, 779 | "created_at":"Sun Jun 27 18:34:01 +0000 2010", 780 | "profile_text_color":"333333" 781 | }, 782 | "id":32188880081920000, 783 | "favorited":false, 784 | "created_at":"Mon Jan 31 21:30:01 +0000 2011" 785 | }, 786 | { 787 | "text":"IIF THE BUS LIIEVES AT 715 NII I GET UP AT 7 THEN IITS NO REASON FOR MEII TO GO CRAZYI II MIISSED THE BUS II MIISSED IIT SO MOMO KISS MY ASS", 788 | "in_reply_to_screen_name":null, 789 | "in_reply_to_status_id":null, 790 | "place":null, 791 | "in_reply_to_user_id":null, 792 | "retweeted":false, 793 | "source":"web", 794 | "id_str":"32188879033344000", 795 | "in_reply_to_status_id_str":null, 796 | "geo":null, 797 | "contributors":null, 798 | "in_reply_to_user_id_str":null, 799 | "retweet_count":0, 800 | "truncated":false, 801 | "coordinates":null, 802 | "user":{ 803 | "profile_sidebar_fill_color":"DDEEF6", 804 | "url":null, 805 | "statuses_count":57, 806 | "geo_enabled":true, 807 | "profile_background_tile":false, 808 | "time_zone":null, 809 | "description":"", 810 | "following":null, 811 | "followers_count":3, 812 | "location":"new orleans\/alabama", 813 | "is_translator":false, 814 | "contributors_enabled":false, 815 | "profile_link_color":"0084B4", 816 | "profile_image_url":"http:\/\/a1.twimg.com\/profile_images\/1022525321\/31274_122653971093835_100000476995337_234977_8368683_n_normal.jpg", 817 | "favourites_count":0, 818 | "profile_sidebar_border_color":"C0DEED", 819 | "id_str":"95760712", 820 | "verified":false, 821 | "screen_name":"LADYKAY504", 822 | "follow_request_sent":null, 823 | "profile_use_background_image":true, 824 | "notifications":null, 825 | "profile_background_color":"C0DEED", 826 | "protected":false, 827 | "profile_background_image_url":"http:\/\/a3.twimg.com\/a\/1296265969\/images\/themes\/theme1\/bg.png", 828 | "name":"lakeisha", 829 | "show_all_inline_media":false, 830 | "id":95760712, 831 | "listed_count":0, 832 | "lang":"en", 833 | "utc_offset":null, 834 | "created_at":"Wed Dec 09 23:39:21 +0000 2009", 835 | "friends_count":110, 836 | "profile_text_color":"333333" 837 | }, 838 | "id":32188879033344000, 839 | "favorited":false, 840 | "created_at":"Mon Jan 31 21:30:01 +0000 2011" 841 | }, 842 | { 843 | "text":"Changing Subject......What Do I Want 2 Eat...@Kiid_Gutts Did Granny Cook 2day", 844 | "in_reply_to_screen_name":null, 845 | "in_reply_to_status_id":null, 846 | "place":null, 847 | "in_reply_to_user_id":null, 848 | "retweeted":false, 849 | "source":"web", 850 | "id_str":"32188875778560000", 851 | "in_reply_to_status_id_str":null, 852 | "geo":null, 853 | "contributors":null, 854 | "in_reply_to_user_id_str":null, 855 | "retweet_count":0, 856 | "truncated":false, 857 | "coordinates":null, 858 | "user":{ 859 | "profile_sidebar_fill_color":"7AC3EE", 860 | "url":null, 861 | "profile_background_tile":true, 862 | "time_zone":"Mountain Time (US & Canada)", 863 | "description":"", 864 | "follow_request_sent":null, 865 | "following":null, 866 | "followers_count":105, 867 | "location":"Cordova TN", 868 | "profile_link_color":"FF0000", 869 | "profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1199859968\/Image11242010162655_normal.jpg", 870 | "show_all_inline_media":false, 871 | "geo_enabled":false, 872 | "favourites_count":1, 873 | "profile_sidebar_border_color":"65B0DA", 874 | "id_str":"48889194", 875 | "statuses_count":3847, 876 | "screen_name":"KandiKoatd", 877 | "listed_count":1, 878 | "profile_use_background_image":true, 879 | "contributors_enabled":false, 880 | "notifications":null, 881 | "profile_background_color":"642D8B", 882 | "protected":false, 883 | "profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/182368478\/images_bigger.jpg", 884 | "friends_count":129, 885 | "name":"Terria Ashley", 886 | "verified":false, 887 | "id":48889194, 888 | "is_translator":false, 889 | "lang":"en", 890 | "utc_offset":-25200, 891 | "created_at":"Sat Jun 20 01:24:59 +0000 2009", 892 | "profile_text_color":"3D1957" 893 | }, 894 | "id":32188875778560000, 895 | "favorited":false, 896 | "created_at":"Mon Jan 31 21:30:00 +0000 2011" 897 | }, 898 | { 899 | "text":"Ah, I believe we got our question! :) Thanks to everyone who submitted\/gave us feedback!", 900 | "in_reply_to_screen_name":null, 901 | "in_reply_to_status_id":null, 902 | "place":null, 903 | "in_reply_to_user_id":null, 904 | "retweeted":false, 905 | "source":"\u003Ca href=\"http:\/\/www.tweetdeck.com\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", 906 | "id_str":"32188873681408000", 907 | "in_reply_to_status_id_str":null, 908 | "geo":null, 909 | "contributors":null, 910 | "in_reply_to_user_id_str":null, 911 | "retweet_count":0, 912 | "truncated":false, 913 | "coordinates":null, 914 | "user":{ 915 | "is_translator":false, 916 | "profile_sidebar_fill_color":"252429", 917 | "url":"http:\/\/www.tom-sturridge.com", 918 | "verified":false, 919 | "profile_background_tile":true, 920 | "time_zone":"Quito", 921 | "description":"Twitter for the Tom Sturridge Fansite - Tom-Sturridge.com -- We're NOT Tom!", 922 | "following":null, 923 | "followers_count":2321, 924 | "location":"", 925 | "follow_request_sent":null, 926 | "profile_link_color":"2FC2EF", 927 | "profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/402485952\/twittPIC_normal.jpg", 928 | "contributors_enabled":false, 929 | "favourites_count":0, 930 | "profile_sidebar_border_color":"181A1E", 931 | "id_str":"30516935", 932 | "screen_name":"TomSturridgecom", 933 | "profile_use_background_image":true, 934 | "show_all_inline_media":false, 935 | "listed_count":79, 936 | "geo_enabled":false, 937 | "notifications":null, 938 | "profile_background_color":"1A1B1F", 939 | "protected":false, 940 | "statuses_count":450, 941 | "profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/8227277\/2.jpg", 942 | "name":"Tom-Sturridge.com", 943 | "friends_count":162, 944 | "id":30516935, 945 | "lang":"en", 946 | "utc_offset":-18000, 947 | "created_at":"Sat Apr 11 20:26:56 +0000 2009", 948 | "profile_text_color":"666666" 949 | }, 950 | "id":32188873681408000, 951 | "favorited":false, 952 | "created_at":"Mon Jan 31 21:30:00 +0000 2011" 953 | }, 954 | { 955 | "text":"in language arts", 956 | "in_reply_to_screen_name":null, 957 | "in_reply_to_status_id":null, 958 | "place":null, 959 | "in_reply_to_user_id":null, 960 | "retweeted":false, 961 | "source":"\u003Ca href=\"http:\/\/mobile.twitter.com\" rel=\"nofollow\"\u003EMobile Web\u003C\/a\u003E", 962 | "id_str":"32188871169024000", 963 | "in_reply_to_status_id_str":null, 964 | "geo":null, 965 | "contributors":null, 966 | "in_reply_to_user_id_str":null, 967 | "retweet_count":0, 968 | "truncated":false, 969 | "coordinates":null, 970 | "user":{ 971 | "follow_request_sent":null, 972 | "profile_sidebar_fill_color":"080808", 973 | "url":"http:\/\/www.myspace.com\/roza009", 974 | "show_all_inline_media":true, 975 | "geo_enabled":true, 976 | "profile_background_tile":true, 977 | "time_zone":"Pacific Time (US & Canada)", 978 | "description":"the name iis Rosa Jackson prefered to be called Jayy' 14 years young and Rape my Follow button hugs and kisses to my FOLLOWERS & skype me at: itsJayy_\ue32b\ue32d\ue328\ue32a", 979 | "statuses_count":1569, 980 | "following":null, 981 | "followers_count":161, 982 | "location":"makiin ur dreamz come tru[:", 983 | "profile_link_color":"2d5aa8", 984 | "profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1198374896\/image_normal.jpg", 985 | "listed_count":2, 986 | "favourites_count":3, 987 | "friends_count":172, 988 | "profile_sidebar_border_color":"b818c7", 989 | "id_str":"207858983", 990 | "screen_name":"ItsJayy_", 991 | "verified":false, 992 | "profile_use_background_image":true, 993 | "notifications":null, 994 | "profile_background_color":"1c6275", 995 | "protected":false, 996 | "is_translator":false, 997 | "contributors_enabled":false, 998 | "profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/182128427\/idk.jpg", 999 | "name":"hmu its Rosa Jackson", 1000 | "id":207858983, 1001 | "lang":"en", 1002 | "utc_offset":-28800, 1003 | "created_at":"Tue Oct 26 05:06:04 +0000 2010", 1004 | "profile_text_color":"4756b8" 1005 | }, 1006 | "id":32188871169024000, 1007 | "favorited":false, 1008 | "created_at":"Mon Jan 31 21:29:59 +0000 2011" 1009 | }, 1010 | { 1011 | "text":"triste noticia..meu cursinho come\u00e7a amanha", 1012 | "in_reply_to_screen_name":null, 1013 | "in_reply_to_status_id":null, 1014 | "place":null, 1015 | "in_reply_to_user_id":null, 1016 | "retweeted":false, 1017 | "source":"web", 1018 | "id_str":"32188870535680000", 1019 | "in_reply_to_status_id_str":null, 1020 | "geo":null, 1021 | "contributors":null, 1022 | "in_reply_to_user_id_str":null, 1023 | "retweet_count":0, 1024 | "truncated":false, 1025 | "coordinates":null, 1026 | "user":{ 1027 | "follow_request_sent":null, 1028 | "profile_sidebar_fill_color":"E5507E", 1029 | "url":null, 1030 | "show_all_inline_media":false, 1031 | "geo_enabled":false, 1032 | "profile_background_tile":true, 1033 | "time_zone":null, 1034 | "description":"", 1035 | "statuses_count":1275, 1036 | "following":null, 1037 | "followers_count":197, 1038 | "location":"", 1039 | "profile_link_color":"B40B43", 1040 | "profile_image_url":"http:\/\/a1.twimg.com\/profile_images\/1193644905\/DSC07138_normal.JPG", 1041 | "listed_count":11, 1042 | "favourites_count":0, 1043 | "friends_count":520, 1044 | "profile_sidebar_border_color":"CC3366", 1045 | "id_str":"168197464", 1046 | "screen_name":"dezi_pink", 1047 | "verified":false, 1048 | "profile_use_background_image":true, 1049 | "notifications":null, 1050 | "profile_background_color":"FF6699", 1051 | "protected":false, 1052 | "is_translator":false, 1053 | "contributors_enabled":false, 1054 | "profile_background_image_url":"http:\/\/a3.twimg.com\/a\/1296265969\/images\/themes\/theme11\/bg.gif", 1055 | "name":"Dezirre", 1056 | "id":168197464, 1057 | "lang":"en", 1058 | "utc_offset":null, 1059 | "created_at":"Sun Jul 18 17:37:15 +0000 2010", 1060 | "profile_text_color":"362720" 1061 | }, 1062 | "id":32188870535680000, 1063 | "favorited":false, 1064 | "created_at":"Mon Jan 31 21:29:59 +0000 2011" 1065 | }, 1066 | { 1067 | "text":"Uhggg im hungry what shall i eat and dont say wings cuzx thats ghetto", 1068 | "in_reply_to_screen_name":null, 1069 | "in_reply_to_status_id":null, 1070 | "place":null, 1071 | "in_reply_to_user_id":null, 1072 | "retweeted":false, 1073 | "source":"\u003Ca href=\"http:\/\/mobile.twitter.com\" rel=\"nofollow\"\u003EMobile Web\u003C\/a\u003E", 1074 | "id_str":"32188868962816000", 1075 | "in_reply_to_status_id_str":null, 1076 | "geo":null, 1077 | "contributors":null, 1078 | "in_reply_to_user_id_str":null, 1079 | "retweet_count":0, 1080 | "truncated":false, 1081 | "coordinates":null, 1082 | "user":{ 1083 | "profile_sidebar_fill_color":"efefef", 1084 | "url":null, 1085 | "is_translator":false, 1086 | "profile_background_tile":true, 1087 | "time_zone":"Quito", 1088 | "description":"Dont know you can sumit up for me", 1089 | "following":null, 1090 | "verified":false, 1091 | "followers_count":4, 1092 | "location":"Miami,Dade county", 1093 | "profile_link_color":"009999", 1094 | "profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/1199496236\/6_normal.jpeg", 1095 | "follow_request_sent":null, 1096 | "favourites_count":0, 1097 | "profile_sidebar_border_color":"eeeeee", 1098 | "id_str":"92817466", 1099 | "contributors_enabled":false, 1100 | "screen_name":"Dunndunn2", 1101 | "profile_use_background_image":true, 1102 | "notifications":null, 1103 | "profile_background_color":"131516", 1104 | "protected":false, 1105 | "show_all_inline_media":false, 1106 | "listed_count":0, 1107 | "geo_enabled":false, 1108 | "profile_background_image_url":"http:\/\/a2.twimg.com\/a\/1296156503\/images\/themes\/theme14\/bg.gif", 1109 | "name":"lexie lashaya", 1110 | "statuses_count":47, 1111 | "id":92817466, 1112 | "lang":"en", 1113 | "utc_offset":-18000, 1114 | "created_at":"Thu Nov 26 19:20:12 +0000 2009", 1115 | "friends_count":7, 1116 | "profile_text_color":"333333" 1117 | }, 1118 | "id":32188868962816000, 1119 | "favorited":false, 1120 | "created_at":"Mon Jan 31 21:29:59 +0000 2011" 1121 | } 1122 | ] 1123 | -------------------------------------------------------------------------------- /build.properties: -------------------------------------------------------------------------------- 1 | # This file is used to override default values used by the Ant build system. 2 | # 3 | # This file must be checked in Version Control Systems, as it is 4 | # integral to the build system of your project. 5 | 6 | # This file is only used by the Ant script. 7 | 8 | # You can use this to override default values such as 9 | # 'source.dir' for the location of your java source folder and 10 | # 'out.dir' for the location of your output folder. 11 | 12 | # You can also use it define how the release builds are signed by declaring 13 | # the following properties: 14 | # 'key.store' for the location of your keystore and 15 | # 'key.alias' for the name of the key to use. 16 | # The password will be asked during the build when you use the 'release' target. 17 | 18 | -------------------------------------------------------------------------------- /build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 27 | 28 | 29 | 33 | 34 | 35 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 47 | 48 | 50 | 62 | 63 | 64 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /gen/com/martinadamek/jsonandroid/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.martinadamek.jsonandroid; 9 | 10 | public final class R { 11 | public static final class attr { 12 | } 13 | public static final class drawable { 14 | public static final int icon=0x7f020000; 15 | } 16 | public static final class id { 17 | public static final int layout=0x7f050000; 18 | public static final int text=0x7f050001; 19 | } 20 | public static final class layout { 21 | public static final int main=0x7f030000; 22 | } 23 | public static final class string { 24 | public static final int app_name=0x7f040000; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /libs/gson-2.2.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinadamek/json-android-compare/0de05775835ca50671a4fde828d197eb8ef52072/libs/gson-2.2.4.jar -------------------------------------------------------------------------------- /libs/jackson-core-2.3.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinadamek/json-android-compare/0de05775835ca50671a4fde828d197eb8ef52072/libs/jackson-core-2.3.0.jar -------------------------------------------------------------------------------- /libs/json-smart-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinadamek/json-android-compare/0de05775835ca50671a4fde828d197eb8ef52072/libs/json-smart-1.1.1.jar -------------------------------------------------------------------------------- /libs/json_simple-1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinadamek/json-android-compare/0de05775835ca50671a4fde828d197eb8ef52072/libs/json_simple-1.1.jar -------------------------------------------------------------------------------- /local.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must *NOT* be checked in Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | 7 | # location of the SDK. This is only used by Ant 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | sdk.dir=/Users/martin/apps/android 11 | -------------------------------------------------------------------------------- /proguard.cfg: -------------------------------------------------------------------------------- 1 | -optimizationpasses 5 2 | -dontusemixedcaseclassnames 3 | -dontskipnonpubliclibraryclasses 4 | -dontpreverify 5 | -verbose 6 | -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* 7 | 8 | -keep public class * extends android.app.Activity 9 | -keep public class * extends android.app.Application 10 | -keep public class * extends android.app.Service 11 | -keep public class * extends android.content.BroadcastReceiver 12 | -keep public class * extends android.content.ContentProvider 13 | -keep public class * extends android.app.backup.BackupAgentHelper 14 | -keep public class * extends android.preference.Preference 15 | -keep public class com.android.vending.licensing.ILicensingService 16 | 17 | -keepclasseswithmembernames class * { 18 | native ; 19 | } 20 | 21 | -keepclasseswithmembernames class * { 22 | public (android.content.Context, android.util.AttributeSet); 23 | } 24 | 25 | -keepclasseswithmembernames class * { 26 | public (android.content.Context, android.util.AttributeSet, int); 27 | } 28 | 29 | -keepclassmembers enum * { 30 | public static **[] values(); 31 | public static ** valueOf(java.lang.String); 32 | } 33 | 34 | -keep class * implements android.os.Parcelable { 35 | public static final android.os.Parcelable$Creator *; 36 | } 37 | -------------------------------------------------------------------------------- /project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-7 15 | -------------------------------------------------------------------------------- /res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinadamek/json-android-compare/0de05775835ca50671a4fde828d197eb8ef52072/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinadamek/json-android-compare/0de05775835ca50671a4fde828d197eb8ef52072/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinadamek/json-android-compare/0de05775835ca50671a4fde828d197eb8ef52072/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | JSON Android Compare 4 | 5 | -------------------------------------------------------------------------------- /screenshots/android_json_compare_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinadamek/json-android-compare/0de05775835ca50671a4fde828d197eb8ef52072/screenshots/android_json_compare_1.png -------------------------------------------------------------------------------- /src/com/martinadamek/jsonandroid/AndroidJson.java: -------------------------------------------------------------------------------- 1 | package com.martinadamek.jsonandroid; 2 | 3 | import java.io.BufferedInputStream; 4 | import java.io.ByteArrayOutputStream; 5 | import java.io.IOException; 6 | import java.io.InputStream; 7 | import java.util.ArrayList; 8 | import java.util.HashMap; 9 | import java.util.Iterator; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | import org.json.JSONArray; 14 | import org.json.JSONObject; 15 | 16 | public class AndroidJson implements TestJson { 17 | 18 | public String getName() { 19 | return "Android"; 20 | } 21 | 22 | public List parsePublicTimeline(InputStream inputStream) { 23 | 24 | List result = new ArrayList(); 25 | 26 | try { 27 | Map map; 28 | JSONObject jsonObject; 29 | JSONObject user; 30 | Iterator iterator; 31 | Iterator iterator2; 32 | String key; 33 | String key2; 34 | 35 | String json = convertStreamToString(inputStream); 36 | JSONArray jsonArray = new JSONArray(json); 37 | int length = jsonArray.length(); 38 | 39 | for (int i = 0; i < length; i++) { 40 | map = new HashMap(); 41 | jsonObject = jsonArray.getJSONObject(i); 42 | iterator = jsonObject.keys(); 43 | while (iterator.hasNext()) { 44 | key = (String) iterator.next(); 45 | if ("user".equals(key)) { 46 | user = jsonObject.getJSONObject(key); 47 | iterator2 = user.keys(); 48 | while (iterator2.hasNext()) { 49 | key2 = (String) iterator2.next(); 50 | map.put("user." + key2, user.get(key2)); 51 | } 52 | } else { 53 | map.put(key, jsonObject.get(key)); 54 | } 55 | } 56 | 57 | result.add(map); 58 | } 59 | } catch (Exception e) { 60 | e.printStackTrace(); 61 | } 62 | 63 | return result; 64 | } 65 | 66 | private static String convertStreamToString(InputStream inputStream) throws IOException { 67 | ByteArrayOutputStream out = new ByteArrayOutputStream(); 68 | InputStream in = new BufferedInputStream(inputStream); 69 | byte[] buffer = new byte[1024]; 70 | int n = 0; 71 | try { 72 | while (-1 != (n = in.read(buffer))) { 73 | out.write(buffer, 0, n); 74 | } 75 | } finally { 76 | out.close(); 77 | in.close(); 78 | } 79 | return out.toString("UTF-8"); 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/com/martinadamek/jsonandroid/GsonJson.java: -------------------------------------------------------------------------------- 1 | package com.martinadamek.jsonandroid; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.io.InputStreamReader; 6 | import java.util.ArrayList; 7 | import java.util.HashMap; 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | import com.google.gson.stream.JsonReader; 12 | import com.google.gson.stream.JsonToken; 13 | 14 | public class GsonJson implements TestJson { 15 | 16 | public String getName() { 17 | return "Gson"; 18 | } 19 | 20 | public List parsePublicTimeline(InputStream inputStream) { 21 | 22 | List result = new ArrayList(); 23 | 24 | try { 25 | Map map; 26 | String name; 27 | String name2; 28 | 29 | JsonReader reader = new JsonReader(new InputStreamReader(inputStream, "UTF-8")); 30 | 31 | reader.beginArray(); 32 | 33 | while (reader.hasNext()) { 34 | map = new HashMap(); 35 | reader.beginObject(); 36 | 37 | while (reader.hasNext()) { 38 | name = reader.nextName(); 39 | if ("user".equals(name)) { 40 | reader.beginObject(); 41 | while (reader.hasNext()) { 42 | name2 = reader.nextName(); 43 | map.put("user." + name2, getValue(reader)); 44 | } 45 | reader.endObject(); 46 | } else { 47 | map.put(name, getValue(reader)); 48 | } 49 | } 50 | 51 | reader.endObject(); 52 | result.add(map); 53 | } 54 | reader.endArray(); 55 | } catch (Exception e) { 56 | e.printStackTrace(); 57 | } 58 | 59 | return result; 60 | } 61 | 62 | static Object getValue(JsonReader r) throws IOException { 63 | Object value = null; 64 | JsonToken token = r.peek(); 65 | 66 | switch (token) { 67 | case NULL: 68 | r.nextNull(); 69 | break; 70 | case BOOLEAN: 71 | value = r.nextBoolean(); 72 | break; 73 | default: 74 | value = r.nextString(); 75 | } 76 | 77 | return value; 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/com/martinadamek/jsonandroid/JacksonJson.java: -------------------------------------------------------------------------------- 1 | package com.martinadamek.jsonandroid; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.util.ArrayList; 6 | import java.util.HashMap; 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | import com.fasterxml.jackson.core.JsonFactory; 11 | import com.fasterxml.jackson.core.JsonParser; 12 | import com.fasterxml.jackson.core.JsonToken; 13 | 14 | public class JacksonJson implements TestJson { 15 | 16 | private static JsonFactory sJsonFactory = new JsonFactory(); 17 | 18 | public String getName() { 19 | return "Jackson"; 20 | } 21 | 22 | public List parsePublicTimeline(InputStream inputStream) { 23 | 24 | List result = new ArrayList(); 25 | 26 | try { 27 | Map map; 28 | String key; 29 | String key2; 30 | 31 | JsonParser p = sJsonFactory.createJsonParser(inputStream); 32 | 33 | p.nextToken(); 34 | 35 | while (p.nextToken() != JsonToken.END_ARRAY) { 36 | 37 | map = new HashMap(); 38 | 39 | while (p.nextToken() != JsonToken.END_OBJECT) { 40 | 41 | key = p.getCurrentName(); 42 | p.nextToken(); // move to value, or START_OBJECT/START_ARRAY 43 | 44 | if (p.getCurrentToken() == JsonToken.START_OBJECT) { 45 | while (p.nextToken() != JsonToken.END_OBJECT) { 46 | key2 = p.getCurrentName(); 47 | p.nextToken(); // move to value, or START_OBJECT/START_ARRAY 48 | map.put("user." + key2, p.getText()); 49 | } 50 | } else { 51 | map.put(key, p.getText()); 52 | } 53 | 54 | } 55 | 56 | result.add(map); 57 | } 58 | 59 | p.close(); 60 | } catch (IOException e) { 61 | e.printStackTrace(); 62 | } 63 | 64 | return result; 65 | } 66 | 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/com/martinadamek/jsonandroid/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.martinadamek.jsonandroid; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.util.ArrayList; 6 | import java.util.Collections; 7 | import java.util.HashMap; 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | import android.app.Activity; 12 | import android.content.res.AssetManager; 13 | import android.os.Bundle; 14 | import android.util.Log; 15 | import android.widget.TextView; 16 | 17 | public class MainActivity extends Activity { 18 | private static final String ASSET_TWITTER_TIMELINE = "public_timeline.json"; 19 | private static final String DATA_LINE_PADDING = " "; 20 | private static final String TAG = MainActivity.class.getName(); 21 | 22 | private TextView mTextView; 23 | private AssetManager mAssetsManager; 24 | 25 | private final Runnable mTestTask = new Runnable() { 26 | public void run() { 27 | 28 | final Map results = new HashMap(); 29 | 30 | testImpl(new AndroidJson(), results); 31 | testImpl(new SimpleJson(), results); 32 | testImpl(new SmartJson(), results); 33 | testImpl(new GsonJson(), results); 34 | testImpl(new JacksonJson(), results); 35 | 36 | runOnUiThread(new Runnable() { 37 | public void run() { 38 | writeToTextView("== Done!"); 39 | 40 | List keys = new ArrayList(results.keySet()); 41 | Collections.sort(keys); 42 | 43 | 44 | int minKeyLength = 0; 45 | for (String key: keys) { 46 | int length = String.valueOf(results.get(key).getParserName()).length(); 47 | 48 | if(length > minKeyLength){ 49 | minKeyLength = length; 50 | } 51 | } 52 | 53 | int minValueLength = 0; 54 | for (String key: keys) { 55 | int length = String.valueOf(results.get(key).getDuration()).length(); 56 | 57 | if(length > minValueLength){ 58 | minValueLength = length; 59 | } 60 | } 61 | 62 | ResultsContainer result; 63 | final String label = "Runs: "; 64 | 65 | int runs = -1; 66 | String perRun; 67 | 68 | for (String key: keys) { 69 | result = results.get(key); 70 | 71 | if(runs != result.getTestRepeats()){ 72 | writeToTextView( 73 | "\n" + 74 | label + result.getTestRepeats()); 75 | 76 | runs = result.getTestRepeats(); 77 | } 78 | 79 | perRun = " (" + result.getDuration() / result.getTestRepeats() + "ms/run)"; 80 | 81 | writeToTextView( 82 | DATA_LINE_PADDING + 83 | StringUtils.padRight(result.getParserName(), minKeyLength) + 84 | ": " + 85 | StringUtils.padLeft(String.valueOf(result.getDuration()), minValueLength) + 86 | "ms" + 87 | perRun); 88 | } 89 | } 90 | }); 91 | 92 | } 93 | }; 94 | 95 | @Override 96 | public void onCreate(Bundle savedInstanceState) { 97 | super.onCreate(savedInstanceState); 98 | setContentView(R.layout.main); 99 | 100 | mTextView = (TextView) findViewById(R.id.text); 101 | mAssetsManager = getAssets(); 102 | 103 | mTextView.setText("Running tests (API Level: " + android.os.Build.VERSION.SDK_INT + ")..." ); 104 | writeToTextView("-----------------"); 105 | 106 | new Thread(mTestTask).start(); 107 | } 108 | 109 | private InputStream getAssetStream(String assetName){ 110 | InputStream res; 111 | 112 | try { 113 | res = mAssetsManager.open( assetName ); 114 | } catch (IOException e) { 115 | Log.e(TAG, "ERROR opening asset '" + assetName + "': " + e.getMessage(), e); 116 | res = null; 117 | } 118 | 119 | return res; 120 | } 121 | 122 | private long test(final TestJson testJson, int repeats) { 123 | InputStream inputStream = getAssetStream(ASSET_TWITTER_TIMELINE); 124 | 125 | List result = testJson.parsePublicTimeline(inputStream); 126 | verify(result); 127 | 128 | long duration = 0; 129 | 130 | for (int i = 0; i < repeats; i++) { 131 | inputStream = getAssetStream(ASSET_TWITTER_TIMELINE); 132 | long start = System.currentTimeMillis(); 133 | testJson.parsePublicTimeline(inputStream); 134 | duration += (System.currentTimeMillis() - start); 135 | } 136 | 137 | return duration; 138 | } 139 | 140 | private void testImpl(final TestJson testJson, Map results) { 141 | runOnUiThread(new Runnable() { 142 | public void run() { 143 | writeToTextView("== Testing '" + testJson.getName() + "'"); 144 | } 145 | }); 146 | 147 | warmUp(testJson); 148 | 149 | int runs = 1; 150 | long duration = test(testJson, runs); 151 | results.put(StringUtils.padLeft(runs, 5) + "_" + testJson.getName(), new ResultsContainer(testJson.getName(), duration, runs)); 152 | 153 | runs = 5; 154 | duration = test(testJson, runs); 155 | results.put(StringUtils.padLeft(runs, 5) + "_" + testJson.getName(), new ResultsContainer(testJson.getName(), duration, runs)); 156 | 157 | runs = 100; 158 | duration = test(testJson, runs); 159 | results.put(StringUtils.padLeft(runs, 5) + "_" + testJson.getName(), new ResultsContainer(testJson.getName(), duration, runs)); 160 | } 161 | 162 | private void warmUp(final TestJson testJson) { 163 | InputStream inputStream; 164 | for (int i = 0; i < 5; i++) { 165 | inputStream = getAssetStream(ASSET_TWITTER_TIMELINE); 166 | testJson.parsePublicTimeline(inputStream); 167 | } 168 | } 169 | 170 | private void writeToTextView(String text){ 171 | mTextView.append("\n"); 172 | mTextView.append(text); 173 | } 174 | 175 | private static void verify(List result) { 176 | if (result.size() != 20) { 177 | throw new IllegalStateException("Expected 20 but was " + result.size()); 178 | } 179 | for (Map map: result) { 180 | if (map.size() != 52) { 181 | throw new IllegalStateException("Expected 52 but was " + result.size()); 182 | } 183 | 184 | } 185 | } 186 | 187 | } 188 | -------------------------------------------------------------------------------- /src/com/martinadamek/jsonandroid/ResultsContainer.java: -------------------------------------------------------------------------------- 1 | package com.martinadamek.jsonandroid; 2 | 3 | public class ResultsContainer { 4 | private final long mDuration; 5 | private final int mTestRepeats; 6 | private final String mParserName; 7 | 8 | public long getDuration() { 9 | return mDuration; 10 | } 11 | 12 | public int getTestRepeats() { 13 | return mTestRepeats; 14 | } 15 | 16 | public String getParserName() { 17 | return mParserName; 18 | } 19 | 20 | public ResultsContainer(String parserName, long duration, int testRepeats){ 21 | mParserName = parserName; 22 | mDuration = duration; 23 | mTestRepeats = testRepeats; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/com/martinadamek/jsonandroid/SimpleJson.java: -------------------------------------------------------------------------------- 1 | package com.martinadamek.jsonandroid; 2 | 3 | import java.io.InputStream; 4 | import java.io.InputStreamReader; 5 | import java.util.ArrayList; 6 | import java.util.HashMap; 7 | import java.util.List; 8 | import java.util.Map; 9 | import java.util.Set; 10 | 11 | import org.json.simple.JSONArray; 12 | import org.json.simple.JSONObject; 13 | import org.json.simple.parser.JSONParser; 14 | 15 | public class SimpleJson implements TestJson { 16 | 17 | public String getName() { 18 | return "JSON.simple"; 19 | } 20 | 21 | public List parsePublicTimeline(InputStream inputStream) { 22 | 23 | List result = new ArrayList(); 24 | 25 | JSONParser p = new JSONParser(); 26 | try { 27 | Map map; 28 | Set keys; 29 | Set keys2; 30 | JSONObject user; 31 | JSONObject jsonObject; 32 | 33 | JSONArray jsonArray = (JSONArray) p.parse(new InputStreamReader(inputStream)); 34 | int size = jsonArray.size(); 35 | 36 | for (int i = 0; i < size; i++) { 37 | map = new HashMap(); 38 | jsonObject = (JSONObject) jsonArray.get(i); 39 | 40 | keys = jsonObject.keySet(); 41 | for (Object key: keys) { 42 | if ("user".equals(key)) { 43 | user = (JSONObject) jsonObject.get(key); 44 | keys2 = user.keySet(); 45 | for (Object key2: keys2) { 46 | map.put("user." + key2, user.get(key2)); 47 | } 48 | } else { 49 | map.put(key, jsonObject.get(key)); 50 | } 51 | } 52 | 53 | result.add(map); 54 | } 55 | 56 | 57 | } catch (Exception e) { 58 | e.printStackTrace(); 59 | } 60 | 61 | return result; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/com/martinadamek/jsonandroid/SmartJson.java: -------------------------------------------------------------------------------- 1 | package com.martinadamek.jsonandroid; 2 | 3 | import java.io.InputStream; 4 | import java.io.InputStreamReader; 5 | import java.util.ArrayList; 6 | import java.util.HashMap; 7 | import java.util.List; 8 | import java.util.Map; 9 | import java.util.Set; 10 | 11 | import net.minidev.json.JSONArray; 12 | import net.minidev.json.JSONObject; 13 | import net.minidev.json.parser.JSONParser; 14 | 15 | public class SmartJson implements TestJson { 16 | 17 | public String getName() { 18 | return "JSON.smart"; 19 | } 20 | 21 | public List parsePublicTimeline(InputStream inputStream) { 22 | 23 | List result = new ArrayList(); 24 | 25 | JSONParser p = new JSONParser(JSONParser.MODE_JSON_SIMPLE); 26 | 27 | try { 28 | Map map; 29 | Set keys; 30 | Set keys2; 31 | JSONObject user; 32 | JSONObject jsonObject; 33 | 34 | JSONArray jsonArray = (JSONArray) p.parse(new InputStreamReader(inputStream)); 35 | int size = jsonArray.size(); 36 | 37 | for (int i = 0; i < size; i++) { 38 | map = new HashMap(); 39 | jsonObject = (JSONObject) jsonArray.get(i); 40 | 41 | keys = jsonObject.keySet(); 42 | for (Object key: keys) { 43 | if ("user".equals(key)) { 44 | user = (JSONObject) jsonObject.get(key); 45 | keys2 = user.keySet(); 46 | for (Object key2: keys2) { 47 | map.put("user." + key2, user.get(key2)); 48 | } 49 | } else { 50 | map.put(key, jsonObject.get(key)); 51 | } 52 | } 53 | 54 | result.add(map); 55 | } 56 | 57 | 58 | } catch (Exception e) { 59 | e.printStackTrace(); 60 | } 61 | 62 | return result; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/com/martinadamek/jsonandroid/StringUtils.java: -------------------------------------------------------------------------------- 1 | package com.martinadamek.jsonandroid; 2 | 3 | import java.util.Map; 4 | 5 | public class StringUtils { 6 | public static String map2json(Map map) { 7 | StringBuilder sb = new StringBuilder("{"); 8 | 9 | for (Object key: map.keySet()) { 10 | sb.append('"').append(key).append('"').append(':').append('"').append(map.get(key)).append('"').append(","); 11 | } 12 | 13 | sb.append("}"); 14 | return sb.toString(); 15 | } 16 | 17 | public static String padLeft(String s, int n) { 18 | return String.format("%1$" + n + "s", s); 19 | } 20 | 21 | public static String padRight(String s, int n) { 22 | return String.format("%1$-" + n + "s", s); 23 | } 24 | 25 | public static String padLeft(long l, int n){ 26 | return String.format("%0"+n+"d", l); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/com/martinadamek/jsonandroid/TestJson.java: -------------------------------------------------------------------------------- 1 | package com.martinadamek.jsonandroid; 2 | 3 | import java.io.InputStream; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | public interface TestJson { 8 | 9 | String getName(); 10 | 11 | List parsePublicTimeline(InputStream inputStream); 12 | 13 | } 14 | --------------------------------------------------------------------------------