2011-04-04 112 views
0

我想解析一個複雜的CSV文件。我在網上搜索了一些資料,但是我只找到簡單的csv帶有昏迷和引號的讀者。但我也包含「{」,「[」和「:」以創建組,子組... 或者你知道一個偉大的(好!)csv閱讀器/解析器嗎?iPhone:複雜的CSV解析器

謝謝!

下面是一個例子:

{ 「元」:{ 「代碼」:200}, 「響應」:{ 「基團」:[{ 「類型」: 「附近」, 「姓名」 :「√Ä proximit√©」,「items」:[{「id」:「4bc88ad72f94d13aa9c5137f」,「name」:「Métro Chaussée©e d'Antin - La Fayette [7,9] 「,」contact「:{},」location「:{」address「:」Mé©Chaussée©e d'Antin - La Fayette「,」city「:」Paris「,」state「:」 「法國」,「postalCode」:「75009」,「lat」:48.872908,「lng」:2.33325,「distance」:39},「categories」:[{「id」:「4bf58dd8d48988d1fd931735」,「命名 「:」 地鐵 「 」圖標「:」 HT tp://foursquare.com/img/categories/travel/subway.png「,」parents「:[」Travel Spots「],」primary「:true}],」verified「:false,」stats「:{ 「checkinsCount」:885, 「usersCount」:368}, 「此時此地」:{ 「計數」:0}},{ 「ID」: 「4ba8e508f964a520e4f739e3」, 「名稱」: 「AdenClassifieds」, 「接觸」:{}, 「location」:{「address」:「1-3 rue La Fayette」,「city」:「Paris」,「state」:「France」,「postalCode」:「75009」,「lat」:48.8733461, 「LNG」:2.3340489, 「距離」:50}, 「類別」:[{ 「ID」: 「4bf58dd8d48988d124941735」, 「名稱」: 「辦公室」, 「圖標」:「http://foursquare.com/img/家庭, 工作, 其他「],」小學「:真正}],」驗證「:假,」統計「:{」checkinsCount「:187, 「usersCount」:29}, 「此時此地」:{ 「計數」:0}},{ 「ID」: 「4c10cd34b4aeef3bad5afc0f」, 「名稱」: 「AdenSourcing」, 「接觸」:{}, 「位置」:{」地址「:」1, rue La Fayette 」, 「城市」: 「巴黎」, 「狀態」: 「法國」, 「郵編」: 「75009」, 「LAT」:48.873009, 「LNG」:2.333263, 「距離」:28}, 「類別」: {「id」:「4bf58dd8d48988d125941735」,「name」:「Tech Startups」,「icon」:「http://foursquare.com/img/categories/building/default.png」,「parents」:[「Homes , Work, Others,「Offices」],「primary」:true},{「id」:「4bf58dd8d48988d174941735」,「name」:「Coworking Spaces」,「icon」:「http:// foursquare。 com/img/categories/building/default.png「,」parents「:[」Homes, Work, Others「,」Offices「]}],」verified「:false,」stats「:{」checkinsCount「: 60, 「usersCount」:7} 「此時此地」:{ 「計數」:0}},{ 「ID」: 「4b6d79c2f964a520f6762ce3」, 「名稱」: 「N√©gatif +」, 「接觸」:{},」位置「:{」address「:」106 rue lafayette「,」city「:」Paris「,」state「:」France「,」postalCode「:」75010「,」lat「:48.873035,」lng「: 2.333 235,「distance」:26},「categories」:[{「id」:「4bf58dd8d48988d1ff941735」,「name」:「Miscellaneous Shops」,「icon」:「http://foursquare.com/img/categories/店/爲Default.png 「 」父母「:[ 」商店「], 」主「:真}], 」驗證「:假, 」統計「:{ 」checkinsCount「:121, 」usersCount「:51},」 hereNow「:{」count「:0}},{」id「:」4beeb21a2c082d7f96b53042「,」name「:」Sephora Haussmann「,」contact「:{」location「:{」address「:」23 bd 「城市」:「巴黎」,「州」:「法蘭西島」,「lat」:48.8728835,「lng」:2.3334661,「distance」:41},「categories」:[ 「id」:「4bf58dd8d48988d10c951735」,「name」:「化妝品 商店」,「圖標」:「http://foursquare.com/img/categories/shops/beauty_cosmetic.png」,「父母」:[「商店」 ], 「主」:真}], 「驗證」:假, 「統計」:{ 「checkinsCount」:135, 「usersCount」:75}, 「此時此地」:{ 「計數」:0}},{「ID 「:」4af55e08f964a520f3f821e3「,」name「:」Chez Jean「,」contact 「:」法國「,」郵政編碼「:」75009「,」拉特「,」法國「,」法國「 :48.8731558, 「LNG」:2。3334978,「distance」:13},「categories」:[{「id」:「4bf58dd8d48988d118951735」,「name」:「Grocery Stores」,「icon」:「http://foursquare.com/img/categories/商店/ food_grocery.png「,」父母「:[」商店「,」食品和飲料 商店「],」主要「:true}],」驗證「:false,」stats「:{」checkinsCount「 「usersCount」:27},「hereNow」:{「count」:0}},{「id」:「4bee9a52e8c3c928dfd89892」,「name」:「H & M」,「contact」:{},「location」 { 「LAT」:48.872951, 「LNG」:2.333551, 「距離」:35}, 「類別」:[{ 「ID」: 「4bf58dd8d48988d104951735」, 「名稱」: 「精品」, 「圖標」:「HTTP:/ /foursquare.com/img/categories/shops/apparel.png","parents":["Shops","Lothing Stores「],」primary「:true}],」verified「:false,」stats「: { 「checkinsCount」:84, 「usersCount」:66}, 「此時此地」:{ 「計數」:0}},{ 「ID」: 「4b51d04df964a520865627e3」, 「名稱」: 「Surcouf酒店」, 「接觸」:{} ,「location」:{「address」:「21, bd Haussmann」,「city」:「巴黎 「 」狀態「: 」法國「, 」POSTALCODE「: 」75009「, 」LAT「:48.8728008, 」LNG「:2.3339615, 」距離「:65}, 」類別「:[{ 」ID「:」 4bf58dd8d48988d122951735 「,」name「:」高 科技 奧特萊斯「,」圖標「:」http://foursquare.com/img/categories/shops/technology.png「,」父母「:[」商店「],」小學「:真正}],」 驗證 「:假的,」 統計 「:{」 checkinsCount 「:332,」 usersCount 「:194},」 此時此地 「:{」 計數 「:0}},{」 ID 「:」 4b1e6795f964a5209a1924e3 「,」name「:」Le Manoir「,」contact「:{},」location「:{」address「:」34 Boulevard Haussmann「,」city「:」Paris「,」state「:」France 「 」POSTALCODE「: 」75009「, 」LAT「:48.872964707066394 」LNG「:2.334015369415283, 」距離「:56}, 」類別「:[{ 」ID「: 」4bf58dd8d48988d16d941735「, 」名稱「:」 Caf√ ©S」, 「圖標」: 「http://foursquare.com/img/categories/food/cafe.png」, 「父母」: 「民以食爲天」], 「主」:真正}], 「驗證」:假, 「統計」:{ 「checkinsCount」:116, 「usersCount」:61}, 「此時此地」:{ 「計數」:0}},{ 「ID」 :「4cb59ee81b0af04dca42ca25」,「name」:「Casa Del Campo」,「contact」:{},「location」:{「address」:「Rue Lafayette」,「city」:「Paris」 :「Ile-de-France」,「lat」:48.873035,「lng」:2.333235,「distance」:26},「categories」:[{「id」:「4bf58dd8d48988d1db931735」,「name」:「Tapas 餐廳」, 「圖標」: 「http://foursquare.com/img/categories/food/default.png」, 「父母」: 「民以食爲天」], 「主」:真正}], 「驗證」:假的, 「stats」:{「checkinsCount」:12,「usersCount」:11},「hereNow」:{「count」:0}},{「id」:「4cdd43c0d5495481874446b2」,「name」:「Thalys Paris> Bruxelles「,」contact「:{},」location「:{」address「:」111 rue Lafayette「,」city「:」Paris「,」state「:」Ile-de-France「,」postalCode「 : 「75011」, 「LAT」:48.873035, 「LNG」:2.333235, 「距離」:26}, 「類別」:[{ 「ID」: 「4bf58dd8d48988d12a951735」, 「名稱」: 「火車」, 「圖標」: 「http://foursquare.com/img/categories/travel/trainstation.png","parents":["Travel Spots」,「Train Stations」],「primary」:true}],「verified」: false,「stats」:{「checkinsCount」:5,「usersCount」:5},「hereNow」:{「count」:0}},{「id」:「4ba3d477f964a520226438e3」,「name」:「Les Diamantaires 「,」contact「:{},」location「:{」address「:」60, Rue Lafayette「,」city「:」Paris「,」state「:」Ile-de-France「,」postalCode「 :「75009」,「lat」:48.873035,「lng」:2.333235,「distance」:26},「categories」:[{「id」:「4bf58dd8d48988d115941735」,「name」:「Middle Eastern Restaurants, 「圖標」: 「http://foursquare.com/img/categories/food/middleeastern.png」, 「父母」: 「民以食爲天」], 「主」:真正}], 「驗證」:假的,「統計「:{」 checkinsCount 「:11」,usersCount 「:10},」 此時此地 「:{」 計數 「:0}},{」 ID 「:」 4cbeb94297bc721e31158167" , 「名稱」: 「Dentiste」, 「接觸」: {},「位置」:{ 「地址」:「36 bd haussmann」,「city」:「Paris」,「state」:「Ile-de-France」,「lat」:48.8729985,「lng」:2.3331688,「distance」 ,「類別」:[{「id」:「4bf58dd8d48988d178941735」,「name」:「牙醫的 辦公室」,「圖標」:「http://foursquare.com/img/categories/building/medical_dentist.png」,「父母「:[」家庭, 工作,其他「,」醫療 中心「],」主要「:真實}],」驗證「:假,」stats「:{」checkinsCount「:9,」usersCount「:2 },「hereNow」:{「count」:0}},{「id」:「4c098514bbc676b0365c48d5」,「name」:「最佳 要放置的地方 裸體」,「contact」:{},「location」:{ 「LAT」:48.872859, 「LNG」:2。333289, 「距離」:43}, 「類別」:[], 「驗證」:假, 「統計」:{ 「checkinsCount」:36, 「usersCount」:21}, 「此時此地」:{ 「計數」:0 「}」,{「id」:「4bbc55912d9ea5937878a0ce」,「name」:「Pizza Tivoli」,「contact」:{},「location」:{「address」:「5 rue La Fayette」 : 「巴黎」, 「狀態」: 「法國」, 「POSTALCODE」: 「75009」, 「LAT」:48.8733461, 「LNG」:2.3340489, 「距離」:50}, 「類別」:[{ 「ID」: 「4bf58dd8d48988d110941735」,「name」:「Italian Restaurants」,「icon」:「http://foursquare.com/img/categories/food/default.png」,「parents」:[「Food」],「primary 「:真}],」 驗證 「:假,」 統計 「:{」 checkinsCount 「:62,」 usersCount 「:47},」 此時此地 「:{」 計數 「:0}},{」 ID 「:」 4be11bf20f03a593908e18b4 「,」name「:」極點 方向Nvx Medias「,」contact「:{},」location「:{」lat「:48.872878,」lng「:2.333277,」distance「:42},」categories「: [], 「驗證」:假, 「統計」:{ 「checkinsCount」:25, 「usersCount」:6} 「此時此地」:{ 「算」:0}},{ 「ID」: 「4c17d044834e2d7f94f02780」, 「名」: 「約瑟芬」, 「接觸」:{}, 「位置」:{ 「城市」: 「巴黎」 , 「狀態」: 「法蘭西島」, 「LAT」:48.872863, 「LNG」:2.333273, 「距離」:43}, 「類別」:[{ 「ID」: 「4bf58dd8d48988d10c941735」, 「姓名」: 「法國 餐館」,「圖標」:「http://foursquare.com/img/categories/food/default.png」,「父母」:[「食物」],「主要」:真實}],「驗證「:假,」 統計 「:{」 checkinsCount 「:14,」 usersCount 「:8},」 此時此地 「:{」 計數 「:0}},{」 ID 「:」 4b597cfcf964a520e68928e3" , 「姓名」:「包圍 Danone「,」contact「:{},」location「:{」address「:」17 boulevard hausmann「,」city「:」Paris「,」lat「:48.873557,」lng「:2.334042,」distance 「:59},」 類別 「:[{」 ID 「:」 4bf58dd8d48988d124941735" , 「名稱」: 「辦公室」, 「圖標」: 「http://foursquare.com/img/categories/building/default.png」 ,「父母」:[「住宅, 工作, 其他」],「主要」:true}],「驗證「:假的,」 統計 「:{」 checkinsCount 「:23,」 usersCount 「:13},」 此時此地 「:{」 計數 「:0}},{」 ID 「:」 4c1f5058fcf8c9b6f66bae0b 「 」名「:」 Obene 「,」contact「:{},」location「:{」address「:」35 rue saint lazarre「,」city「:」Paris「,」state「:」Francr「,」postalCode「:」75009「 ,「lat」:48.872829,「lng」:2.333201,「distance」:48​​},「categories」:[{「id」:「4bf58dd8d48988d1c0941​​735」,「name」:「Mediterranean Restaurants」,「icon」 ://foursquare.com/img/categories/food/default.png」, 「父母」: 「民以食爲天」], 「主」:真正}], 「驗證」:假的, 「統計」:{ 「checkinsCount」 :21,「usersCount」:5},「hereNow」:{「count」:0}},{「id」:「4d5133ac9ffc236a026720a7」,「name」:「Sofa Cafe Studio」,「contact」 ,「location」:{「lat」:48.873568,「lng」:2.33384,「distance」:48​​},「categories」:[{「id」:「4bf58dd8d48988d10c941735」,「name」:「French Restaurants」圖標 「:」 http://foursquare.com/img/categories/food/default。 PNG」, 「父母」:[ 「食品」], 「主」:真}], 「驗證」:假, 「統計」:{ 「checkinsCount」:11 「usersCount」:10}, 「此時此地」:{ 「count」:0}},{「id」:「4cfa4adf2d80a1438a9f43d8」,「name」:「Manucurist」,「contact」:{},「location」:{「address」:「Rue de la chausse d antin 」, 「城市」: 「巴黎」, 「狀態」: 「法蘭西島」, 「LAT」:48.87294352054596, 「LNG」:2.333693504333496, 「距離」:41}, 「類別」:[{ 「ID」 :「4bf58dd8d48988d10c951735」,「姓名」:「化妝品 商店」,「圖標」:「http://foursquare.com/img/categories/shops/beauty_cosmetic.png」,「父母」:[「商店」],主 「:真}],」 驗證 「:假,」 統計 「:{」 checkinsCount 「:28,」 usersCount 「:4},」 此時此地 「:{」 計數 「:0}},{」 ID 「:」 Fayette「,」contact「:{},」location「:{」lat「:48.872853,」lng「:2.333072,」distance「:49},」categories 「:[{」id「:」4bf58dd8d48988d10c941735「,」name「:」法語 Re staurants」, 「圖標」: 「http://foursquare.com/img/categories/food/default.png」, 「父母」: 「民以食爲天」], 「主」:真正}], 「驗證」:假的「統計」:{ 「checkinsCount」:20, 「usersCount」:15}, 「此時此地」:{ 「計數」:0}},{ 「ID」: 「4c124b6377cea59338bccc60」, 「名稱」: 「中午」,」 contact「:{},」location「:{」address「:」Rue de la chaussee d antin「,」city「:」Paris「,」state「:」Ile-de-France「,」lat「 48.8736428,「lng」:2.3330026,「distance」:51},「categories」:[{「id」:「4bf58dd8d48988d146941735」,「name」:「Delis or Bodegas」,「icon」 foursquare.com/img/categories/food/deli。PNG」, 「父母」:[ 「食品」], 「主」:真}], 「驗證」:假, 「統計」:{ 「checkinsCount」:15, 「usersCount」:12}, 「此時此地」:{ 「count」:0}},{「id」:「4bb2f78ea32876b0173a01fe」,「name」:「Glam Media France(temp Offices)」,「contact」:{},「location」:{「address」:「 21 bd Haussman「city」:「Paris」,「lat」:48.87305,「lng」:2.333831,「distance」:39},「categories」:[{「id」:「4bf58dd8d48988d125941735」,「name 「:」Tech Startups「,」icon「:」http://foursquare.com/img/categories/building/default.png「,」parents「:[」Homes, Work, Others「,」Offices「 ], 「主」:真}], 「驗證」:假, 「統計」:{ 「checkinsCount」:7, 「usersCount」:4}, 「此時此地」:{ 「計數」:0}},{「ID 「:」4c122cd7583c9c74bf323fa4「,」name「:」Havaianas 歡迎夏天@老佛爺 拉斐特「,」聯繫方式「:{」phone「:」014282345 6「,」twitter「:」havaianaseurope「},」location「:{」address「:」40 boulevard Haussmann「,」city「:」75009 Paris「,」state「:」France「,」country「 「法國」,「拉特」:48.8731566,「lng」:2.3327878,「距離」:44},「類別」:[{「id」:「4bf58dd8d48988d107951735」,「名稱」:「鞋子 商店」 :「http://foursquare.com/img/categories/shops/apparel.png」,「父母」:[「商店」,「服裝 商店」],「主要」:true}],「verified」:true ,「stats」:{「checkinsCount」:11,「usersCount」:9},「hereNow」:{「count」:0}},{「id」:「4b9a40c4f964a52081a735e3」,「name」:「little georgette」 , 「接觸」:{}, 「位置」:{ 「LAT」:48.872544, 「LNG」:2.33322, 「距離」:79}, 「類別」:[{ 「ID」: 「4bf58dd8d48988d10c941735」, 「姓名」: 「法國 餐館」,「圖標」:「http://foursquare.com/img/categories/food/default.png」,「父母」:[「食物」],「主要」:真實}],「驗證「:假的,」 統計 「:{」 checkinsCount 「:60,」 用戶計數 「:41},」 此時此地 「:{」 計數 「:0}},{」 ID 「:」 4c319736213c2d7f5e33345d 「 」名稱「: 」Isiom「, 」接觸「:{}, 」位置「:{」 LAT 「:48.872815,」 LNG 「:2.333228,」 距離 「:49},」 類別 「:[{」 ID 「:」 4bf58dd8d48988d124941735" , 「名稱」: 「辦公室」, 「圖標」:「HTTP://四角。 com/img/categories/building/default.png「,」parents「:[」Homes, Work, Others「],」primary「:true}],」verified「:false,」stats「:{」checkinsCount 「:7,」 usersCount 「:2},」 此時此地 「:{」 計數 「:0}},{」 ID 「:」 4c89f5e49ef0224b0595567b 「 」名稱「: 」Cardiweb「, 」接觸「:{},」 位置「:{」 城市 「:」 巴黎 「 」狀態「: 」法蘭西島「, 」LAT「:48.873727, 」LNG「:2.33362, 」距離「:55}, 」類別「:[{」 ID 「:」4bf58dd8d48988d124941735「,」名稱「:」辦公室「,」圖標「:」http://foursquare.com/img/categories/building/default.png「,」父母「:[」住宅, 工作, 其他 「],」 主 「:真}],」 驗證 「:假,」 統計 「:{」 checkinsCount 「:5」,usersCount 「:3}」,此時此地 「:{」 計數「:0}},{ 「ID」:「4c507cf7991c20a18e0147 86「,」name「:」Focus Groups「,」contact「:{},」location「:{」lat「:48.872982,」lng「:2.33353,」distance「:31} 「id」:「4bf58dd8d48988d124941735」,「name」:「Offices」,「icon」:「http://foursquare.com/img/categories/building/default.png」,「parents」:[「Homes, Work , 其他「],」primary「:true}],」verified「:false,」stats「:{」checkinsCount「:1,」usersCount「:1},」hereNow「:{」count「:0}} ]}]}}

回答

5

看起來像JSON,而不是CSV。使用這個JSON框架來解析文件:http://code.google.com/p/json-framework/

+0

我是這樣一個白癡.... thakns很多 – Bejil 2011-04-04 11:37:21

+1

順便說一句,[這裏](http://chris.photobooks.com/json/default.htm)是一個非常好的在線JSON可視化工具。您粘貼您的JSON文本並點擊「渲染」,它會將整個事件細分爲包含內容的內容,使其更易於理解和導航。 – 2011-04-04 13:15:53

+0

非常好,非常有用! – Bejil 2011-04-08 09:08:35