Skip to content

Instantly share code, notes, and snippets.

@edolopez
Created April 24, 2013 16:48
Show Gist options
  • Save edolopez/5453635 to your computer and use it in GitHub Desktop.
Save edolopez/5453635 to your computer and use it in GitHub Desktop.
GNIP data received. Comparing good hash structure and bad hash structure
//Valid JSON format for tweet received
{
"id": "tag:search.twitter.com,2005:327100841452519425",
"objectType": "activity",
"actor": {
"objectType": "person",
"id": "id:twitter.com:114054810",
"link": "http://www.twitter.com/anuel_81",
"displayName": "luis enrique anuel",
"postedTime": "2010-02-13T23:51:24.000Z",
"image": "http://a0.twimg.com/profile_images/3559388330/ec9cb7ee00b241c2f4a6deef04c6600e_normal.jpeg",
"summary": null,
"links": [
{
"href": null,
"rel": "me"
}
],
"friendsCount": 292,
"followersCount": 237,
"listedCount": 2,
"statusesCount": 574,
"twitterTimeZone": "Caracas",
"verified": false,
"utcOffset": "-16200",
"preferredUsername": "anuel_81",
"languages": [
"es"
],
"location": {
"objectType": "place",
"displayName": "cumana"
},
"favoritesCount": 3
},
"verb": "share",
"postedTime": "2013-04-24T16:44:52.000Z",
"generator": {
"displayName": "web",
"link": "http://twitter.com"
},
"provider": {
"objectType": "service",
"displayName": "Twitter",
"link": "http://www.twitter.com"
},
"link": "http://twitter.com/anuel_81/statuses/327100841452519425",
"body": "RT @moni_urda: \"@anuel_81: @moni_urda asi es camarada la #tropa de chavez y maduro #DerrotandoAlFascismo . q viva chavez por siempre !\" VI…",
"object": {
"id": "tag:search.twitter.com,2005:327100404590592000",
"objectType": "activity",
"actor": {
"objectType": "person",
"id": "id:twitter.com:305823439",
"link": "http://www.twitter.com/moni_urda",
"displayName": "YoChávez",
"postedTime": "2011-05-26T21:06:16.000Z",
"image": "http://a0.twimg.com/profile_images/3555173523/103dd909d07f4cfd6a73f193aedc9daa_normal.jpeg",
"summary": "Soy Caraqueña. Soy Chavista Radical. Soy Fundación Infocentro. Soy Radio Picúa. Soy Software Libre. Soy #AmorRevolucionario",
"links": [
{
"href": "http://formacioninfocentro.blogspot.com/",
"rel": "me"
}
],
"friendsCount": 3250,
"followersCount": 4077,
"listedCount": 38,
"statusesCount": 32902,
"twitterTimeZone": "Caracas",
"verified": false,
"utcOffset": "-16200",
"preferredUsername": "moni_urda",
"languages": [
"es"
],
"location": {
"objectType": "place",
"displayName": "Nva Esparta, Venezuela"
},
"favoritesCount": 647
},
"verb": "post",
"postedTime": "2013-04-24T16:43:08.000Z",
"generator": {
"displayName": "Twitter for Android",
"link": "http://twitter.com/download/android"
},
"provider": {
"objectType": "service",
"displayName": "Twitter",
"link": "http://www.twitter.com"
},
"link": "http://twitter.com/moni_urda/statuses/327100404590592000",
"body": "\"@anuel_81: @moni_urda asi es camarada la #tropa de chavez y maduro #DerrotandoAlFascismo . q viva chavez por siempre !\" VIVA..!!",
"object": {
"objectType": "note",
"id": "object:search.twitter.com,2005:327100404590592000",
"summary": "\"@anuel_81: @moni_urda asi es camarada la #tropa de chavez y maduro #DerrotandoAlFascismo . q viva chavez por siempre !\" VIVA..!!",
"link": "http://twitter.com/moni_urda/statuses/327100404590592000",
"postedTime": "2013-04-24T16:43:08.000Z"
},
"favoritesCount": 0,
"twitter_entities": {
"hashtags": [
{
"text": "tropa",
"indices": [
43,
49
]
},
{
"text": "DerrotandoAlFascismo",
"indices": [
69,
90
]
}
],
"symbols": [],
"urls": [],
"user_mentions": [
{
"screen_name": "anuel_81",
"name": "luis enrique anuel",
"id": 114054810,
"id_str": "114054810",
"indices": [
1,
10
]
},
{
"screen_name": "moni_urda",
"name": "YoChávez",
"id": 305823439,
"id_str": "305823439",
"indices": [
12,
22
]
}
]
}
},
"favoritesCount": 0,
"twitter_entities": {
"hashtags": [
{
"text": "tropa",
"indices": [
58,
64
]
},
{
"text": "DerrotandoAlFascismo",
"indices": [
84,
105
]
}
],
"symbols": [],
"urls": [],
"user_mentions": [
{
"screen_name": "moni_urda",
"name": "YoChávez",
"id": 305823439,
"id_str": "305823439",
"indices": [
3,
13
]
},
{
"screen_name": "anuel_81",
"name": "luis enrique anuel",
"id": 114054810,
"id_str": "114054810",
"indices": [
16,
25
]
},
{
"screen_name": "moni_urda",
"name": "YoChávez",
"id": 305823439,
"id_str": "305823439",
"indices": [
27,
37
]
}
]
},
"twitter_filter_level": "low",
"retweetCount": 1,
"gnip": {
"matching_rules": [
{
"value": "chavez",
"tag": null
}
],
"klout_score": 41,
"language": {
"value": "es"
}
}
}
//Invalid tweet received. Bad JSON format
{
"id": "tag:search.twitter.com,2005:327100851611119616",
"objectType": "activity",
"actor": {
"objectType": "person",
"id": "id:twitter.com:256948883",
"link": "http://www.twitter.com/NandoQuintuna",
"displayName": "Fernando Quintuña",
"postedTime": "2011-02-24T11:57:35.000Z",
"image": "http://a0.twimg.com/profile_images/3496900965/78ea379c4f7c4f7df809f0970ea74f23_normal.jpeg",
"summary": "Bloqueen 100 veces mi cuenta, entonces 101 veces mas estaré, cada día mas comprometido y respaldando a los gobiernos d izquierda y progresistas de latinoamerica",
"links": [
{
"href": null,
"rel": "me"
}
],
"friendsCount": 1836,
"followersCount": 1434,
"listedCount": 1,
"statusesCount": 2609,
"twitterTimeZone": null,
"verified": false,
"utcOffset": null,
"preferredUsername": "NandoQuintuna",
"languages": [
"es"
],
"location": {
"objectType": "place",
"displayName": "latinoamericano."
},
"favoritesCount": 34
},
"verb": "share",
"postedTime": "2013-04-24T16:44:54.000Z",
"generator": {
"displayName": "Twitter for Android",
"link": "http://twitter.com/download/android"
},
"provider": {
"objectType": "service",
"displayName": "Twitter",
"link": "http://www.twitter.com"
},
"link": "http://twitter.com/NandoQuintuna/statuses/327100851611119616",
"body": "RT @maatarmonia: @MashiRafael EN ESTA PATRIA DE CHAVEZ SEGUIMOS EN LUCHA CONTRA ESTOS FASCISTAS PERO VENCEREMOS Y VIVIREMOS. VIVA CHAVEZ",
"object": {
"id": "tag:search.twitter.com,2005:327099410632802305",
"objectType": "activity",
"actor": {
"objectType": "person",
"id": "id:twitter.com:334182762",
"link": "http://www.twitter.com/maatarmonia",
"displayName": "yolaleon",
"postedTime": "2011-07-12T18:08:33.000Z",
"image": "http://a0.twimg.com/sticky/default_profile_images/default_profile_4_normal.png",
"summary": null,
"links": [
{
"href": null,
"rel": "me"
}
],
"friendsCount": 120,
"followersCount": 77,
"listedCount": 0,
"statusesCount": 1561,
"twitterTimeZone": null,
"verified": false,
"utcOffset": null,
"preferredUsername": "maatarmonia",
"languages": [
"es"
],
"favoritesCount": 0
},
"verb": "post",
"postedTime": "2013-04-24T16:39:11.000Z",
"generator": {
"displayName": "web",
"link": "http://twitter.com"
},
"provider": {
"objectType": "service",
"displayName": "Twitter",
"link": "http://www.twitter.com"
},
"link": "http://twitter.com/maatarmonia/statuses/327099410632802305",
"body": "@MashiRafael EN ESTA PATRIA DE CHAVEZ SEGUIMOS EN LUCHA CONTRA ESTOS FASCISTAS PERO VENCEREMOS Y VIVIREMOS. VIVA CHAVEZ",
"object": {
"objectType": "note",
"id": "object:search.twitter.com,2005:327099410632802305",
"summary": "@MashiRafael EN ESTA PATRIA DE CHAVEZ SEGUIMOS EN LUCHA CONTRA ESTOS FASCISTAS PERO VENCEREMOS Y VIVIREMOS. VIVA CHAVEZ",
"link": "http://twitter.com/maatarmonia/statuses/327099410632802305",
"postedTime": "2013-04-24T16:39:11.000Z"
},
"favoritesCount": 0,
"twitter_entities": {
"hashtags": [
],
"symbols": [
],
"urls": [
],
"user_mentions": [
{
"screen_name": "MashiRafael",
"name": "Rafael Correa",
"id": 209780362,
"id_str": "209780362",
"indices": [
0,
12
]
}
]
}
},
"favoritesCount": 0,
"twitter_entities": {
"hashtags": [
],
"symbols": [
],
"urls": [
],
"user_mentions": [
{
"screen_name": "maatarmonia",
"name": "yolaleon",
"id": 334182762,
"id_str": "334182762",
"indices": [
3,
15
]
},
{
"screen_name": "MashiRafael",
"name": "Rafael Correa",
"id": 209780362,
"id_str": "209780362",
"indices": [
17,
29
]
}
]
},
"twitter_filter_level": "low",
"retweetCount": 1,
"gnip": {
"matching_rules": [
{
"value": "chavez",
"tag": null
}
],
"klout_score": 45,
"language": {
"value": "es"
}
}
}{
"id": "tag:search.twitter.com,2005:327100850881314818",
"objectType": "activity",
"actor": {
"objectType": "person",
"id": "id:twitter.com:420501665",
"link": "http://www.twitter.com/salazarsubero",
"displayName": "daniela",
"postedTime": "2011-11-24T18:21:56.000Z",
"image": "http://a0.twimg.com/profile_images/3209299075/0893b069f150c5d5c92b6730b737a18d_normal.jpeg",
"summary": "Lo que soy, es real Soy exactamente la que debo ser hoy..daniela salazar : actriz y modelo si me sigues te sigo",
"links": [
{
"href": null,
"rel": "me"
}
],
"friendsCount": 1727,
"followersCount": 812,
"listedCount": 0,
"statusesCount": 797,
"twitterTimeZone": "Hawaii",
"verified": false,
"utcOffset": "-36000",
"preferredUsername": "salazarsubero",
"languages": [
"es"
],
"favoritesCount": 88
},
"verb": "post",
"postedTime": "2013-04-24T16:44:54.000Z",
"generator": {
"displayName": "Tweet Button",
"link": "http://twitter.com/tweetbutton"
},
"provider": {
"objectType": "service",
"displayName": "Twitter",
"link": "http://www.twitter.com"
},
"link": "http://twitter.com/salazarsubero/statuses/327100850881314818",
"body": "Chavez Vivira - Lucia Valentina ft Carlos El Potrillo: http://t.co/zGmUzUku62 vía @youtube",
"object": {
"objectType": "note",
"id": "object:search.twitter.com,2005:327100850881314818",
"summary": "Chavez Vivira - Lucia Valentina ft Carlos El Potrillo: http://t.co/zGmUzUku62 vía @youtube",
"link": "http://twitter.com/salazarsubero/statuses/327100850881314818",
"postedTime": "2013-04-24T16:44:54.000Z"
},
"favoritesCount": 0,
"twitter_entities": {
"hashtags": [
],
"symbols": [
],
"urls": [
{
"url": "http://t.co/zGmUzUku62",
"expanded_url": "http://youtu.be/IvwiVjcLGSo",
"display_url": "youtu.be/IvwiVjcLGSo",
"indices": [
55,
77
]
}
],
"user_mentions": [
{
"screen_name": "YouTube",
"name": "YouTube",
"id": 10228272,
"id_str": "10228272",
"indices": [
82,
90
]
}
]
},
"twitter_filter_level": "medium",
"retweetCount": 0,
"gnip": {
"matching_rules": [
{
"value": "chavez",
"tag": null
}
],
"urls": [
{
"url": "http://t.co/zGmUzUku62",
"expanded_url": "http://www.youtube.com/watch?v=IvwiVjcLGSo&feature=youtu.be"
}
],
"klout_score": 31,
"language": {
"value": "es"
}
}
}
@Adrian2112
Copy link

The problem with the bad one is that we are getting 2 json objects that are not inside an array and is lacking the comma

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment