Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 15 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
15
Dung lượng
268,45 KB
Nội dung
HƯỚNG DẪN PHÂN TÍCH JSON Json ? Làm để lấy phân tích cú pháp Json ? … hướng dẫn giúp bạn trả lời câu hỏi JSON (viết tắt JavaScript Object Notation) dựa văn để lưu trữ trao đổi liệu cách nhẹ dễ dàng Nó thường sử dụng để đại diện cho liệu cấu trúc trao đổi liệu ứng dụng client-server, phục vụ thay cho XML Rất nhiều dịch vụ sử dụng hàng ngày có API JSON-based Hầu hết ứng dụng iOS bao gồm Twitter, Facebook Flick gửi liệu đến dịch vụ web phụ trợ họ định dạng JSON ví dụ: favorites = ( { artist = Brandy; “image_large” = “https://i.scdn.co/image/8a161e85351a20aaf4f4099cc89e1b8fb726e035”; “image_medium” = “https://i.scdn.co/image/3f3b3c7e4d4feabb73c885b38500d1427260ae33”; “image_small” = “https://i.scdn.co/image/4dcf0d5722e62cdfaf620a773f010e6b2dd15b78”; “open_url” = “https://open.spotify.com/track/6esN4GvN6uRe1SVVNElHDq”; “preview_url” = “https://p.scdn.co/mp3preview/33add4c82a52fbaf7665b8dee3da1c73b2406775”; “song_id” = 54dd0bc8a57fa90c00770523; title = “I Wanna Be Down – Single Version”; }, { artist = “Destiny’s Child”; “image_large” = “https://i.scdn.co/image/bf0f79acd50add01e88575664fe98d8d44d3123f”; “image_medium” = “https://i.scdn.co/image/a7aef2e8232955bb94d7c041a0fbc06b2bb8fe7f”; “image_small” = “https://i.scdn.co/image/fdf76dbe620b71af39d775274795c0ca2829c19f”; “open_url” = “https://open.spotify.com/track/72oq9xR8MK5CLpI185xaVy”; “preview_url” = “https://p.scdn.co/mp3preview/ca5baaecfef5ce51277e105f71a8d63240b734d8”; “song_id” = 54dd0bc8a57fa90c00770606; title = Survivor; }, Như bạn thấy, liệu JSON người đọc dễ dàng với việc phân tích XML.Kể từ phát hành iOS 5, iOS SDK làm cho dễ dàng để lấy phân tích liệu JSON… Mình làm rõ cú pháp Json hướng dẫn … cho bạn thấy đơn giản nhẹ nhàng sử dụng json lưu trữ! Phần 1: Mình hướng dẫn cho bạn phân tích trả json,Json mặc định ,Json setMethod ,json có tham số! Phần 2: Mình đổ liệu tabaleView:imageView,label… Bắt đầu nào! khởi tạo project đặt tên: Json! Thiết kế giao diện : vào file Main.storyboardard: thêm button đặt tên! button1 sử dụng phương pháp NSUrlConnection để gọi json! button2 sử dụng phương pháp NSUrlsession để gọi json! Ánh xạ button sang class ViewController quản lý: - (IBAction)urlConnection:(id)sender { } - (IBAction)session{ } NSUrlConnection sử dụng với IOS cũ, Mới dùng được, Tuy nhiên không chạy chế độ app chạy ẩn!, không cho phép dụng tải! NSUrlSession sử dụng với IOS trở lên ,và bổ sung phương thức cho phép dừng tải liệu về, cho phép chạy ẩn load liệu…Khuyên dùng Session API bạn hiểu sâu không hướng dẫn đây, Để giúp bạn chưa hiểu gì, đơn giản bạn hiểu đường dẫn truy vấn qua Đầu tiên hướng dẫn bạn sử dụng NSUrlConnnection! Trong url urlConnnection ta vừa ánh xạ sang, Thêm đoạn mã sau! - (IBAction)urlConnection:(id)sender { NSString *strUrl=@"https://ionic-songhop.herokuapp.com/login"; NSURL *url=[NSURL URLWithString:strUrl]; NSURLRequest *request= [NSURLRequest requestWithURL:url]; [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse * response, NSData * data, NSError * connectionError) { if (connectionError==nil) { 10 11 12 13 14 NSLog(@"%@",data); }else{ NSLog(@"%@",connectionError); } }]; NSLog(@"requesting"); 15 } Đầu tiên lấy chuỗi đường dẫn đến nơi cung cấp API free! Chuyển đổi thành url-> chuyển đổi thành request NSURLConnection có phương thức chung sendAsychronousRequest để lấy liệu dạng data Tham số truyền vào request , Đăng ký đa luồng queue:[NSOperationQueuemainQueue], Mainqueue luồng chạy app đăng ký luồng phụ chuyên load liệu từ mạng Nếu ta không đăng ký đa luồng ứng dụng chạy đến đoạn tải liệu chờ load, thời gian app bị dừng timeout Đăng ký chạy đa luồng giúp cho việc load liệu chạy luồng riêng hoàn thành trả block cho mainqueue update liệu block trả có data or error : Kiểm tra có lỗi thông báo error không trả data Chạy thử bạn nhận đượcđược : 2016-05-23 10:15:34.314 Json[829:14677] requesting 2016-05-23 10:15:34.913 Json[829:14677] Như có data trả về! Tiếp theo sử dụng NSURLSession: Ở viết hàm có truyền tham số, có truyền đường dẫn cung cấp API tham số para vs đường dẫn urlApi ban đầu đơn giản chưa sử dụng tham số truyền, chưa xét phương thức gửi liệu! Mình làm tương tự connection,lấy url chuyển thành request, Tuy nhiên session chạy task task luồng riêng trả block riêng không sử dụng queue để xếp luồng sử dụng phương thức sharedSession để gọi dataTaskWithRequest: tham số truyền vào request mà vừa tạo, có liệu hoàn thành trả block -> trả cho task task cho phép tải dừng!Để đơn giản log data -(void)urlSession:(NSDictionary *)para urlApi:(NSString*)urlApi{ NSURL *url=[NSURL URLWithString:urlApi]; NSMutableURLRequest *request= [NSMutableURLRequest requestWithURL:url]; NSURLSessionDataTask *task=[[NSURLSession sharedSession]dataTaskWithRequest:request 10 11 12 13 14 completionHandler:^(NSData * data, NSURLResponse *response, NSError *error) { NSError *errorData; if (error==nil) { NSLog(@"%@",data); }else{ NSLog(@"%@",error); } }]; [task resume]; 15 } Chúng ta truyền tham số đường dẫn nhấn vào button session! - (IBAction)session{ NSString *strUrl=@"https://ionic-songhop.herokuapp.com/login"; NSDictionary *key=@{@"username":@"hiep"}; [self urlSession:key urlApi:strUrl]; } NSLog kết quả: 2016-05-23 10:15:34.913 Json[829:14677] tất phương pháp trả data chưa chuyển chúng sang Json! Để đơn giản làm việc với NSURLSession trả Json connection tương tự đoạn chuyển đổi sang Json thay đổi đoạn mã không NSLog data khai báo NSError *errorData để trả Json.do API biết kiểu dictionary nên ta khai báo conten [NSJSONSerialization JSONObjectWithData:dataoptions:NSJSONReadingAllowFragm ents error:&errorData]; truyền vào data cần chuyển đổi thành json, kiểu lề,truyền vào error có lỗi json.Kiểm tra lỗi xuất json có lỗi xuất lỗi chuyển bó sang kiểu UTF8 để đọc lỗi -(void)urlSession:(NSDictionary *)para urlApi:(NSString*)urlApi{ NSURL *url=[NSURL URLWithString:urlApi]; NSMutableURLRequest *request= [NSMutableURLRequest requestWithURL:url]; NSURLSessionDataTask *task=[[NSURLSession sharedSession]dataTaskWithRequest:request completionHandler:^(NSData * data, NSURLResponse *response, NSError *error) { NSError *errorData; if (error==nil) {// kiểm tra có data NSDictionary *conten=[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments 10 11 12 13 14 15 error:&errorData]; if (errorData==nil) { NSLog(@"%@",conten); }else{ NSString *contenError=[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"%@",contenError); } } }]; 16 } Biên dịch chạy thử ta kết sau: 2016-05-23 10:50:30.650 Json[973:39016] Not Found undefined undefined Xuất lỗi không trả Json liệu kiểu Json Hàm mặc định phương thức trả data get.Lỗi đường dẫn trả API phương thức get mà phương thức thức post chúng ta thêm câu lệnh xét phương thức trả về: [request setHTTPMethod:@"POST"]; thêm sau đoạn trả request! -(void)urlSession:(NSDictionary *)para urlApi:(NSString*)urlApi{ NSURL *url=[NSURL URLWithString:urlApi]; NSMutableURLRequest *request= [NSMutableURLRequest requestWithURL:url]; [request setHTTPMethod:@"POST"]; NSURLSessionDataTask *task=[[NSURLSession sharedSession]dataTaskWithRequest:request completionHandler:^(NSData * data, NSURLResponse *response, NSError *error) { NSError *errorData; if (error==nil) {// kiểm tra có data NSDictionary *conten=[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&errorData]; if (errorData==nil) { 10 NSLog(@"%@",conten); 11 }else{ 12 NSString *contenError=[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 13 NSLog(@"%@",contenError); 14 } 15 } 16 }]; 17 } chạy biên dịch NSLog đoạn mã json sau: 2016-05-23 10:57:09.299 Json[990:40954] { 10 11 12 13 14 15 16 17 18 19 favorites = ( { artist = "Mr Big"; "image_large" = "https://i.scdn.co/image/a16e2885c64a9019f308bd21dc717e14819ea93b"; "image_medium" = "https://i.scdn.co/image/737ee10e67a9829b04fba3dbd5a7df49442cb8e3"; "image_small" = "https://i.scdn.co/image/71675961c21c2a48c87e154e178fa1b21e73e8d4"; "open_url" = "https://open.spotify.com/track/4E7D9GuRmqsz2rizLOiQom"; "preview_url" = "https://p.scdn.co/mp3-preview/4a2b0fd83318acff32e60c58deb0079ceeffce3d"; "song_id" = 54dd0bc8a57fa90c0077065b; title = "To Be With You"; }, { artist = "Gwen Stefani"; "image_large" = "https://i.scdn.co/image/021fe86098015008463597fbd1b40ea0aca3bb14"; "image_medium" = "https://i.scdn.co/image/78d2d152c50e139dd29bd8e02f892bfc3af7fc6b"; "image_small" = "https://i.scdn.co/image/49ddb3c72d514b9764cd0e90eee2fe218cb9ae3b"; "open_url" = "https://open.spotify.com/track/4t0DvmrYqArFKKqCtdaXfG"; "preview_url" = "https://p.scdn.co/mp3-preview/dd120963776598cfe865fd8301e1987d4e72c49c"; 20 21 22 23 24 25 "song_id" = 54dd0bc8a57fa90c0077054a; title = "Rich Girl"; } ); "session_id" = 571a3372af073411005963c7; username = jay; 26 } đọc Json Tuy nhiên sử dụng tham số para ? Tham số truyền ? ví dụ CSDL có lưu thông tin người dùng họ yêu thích hát gì, truyện … người dùng para tham số Để truy vấn liệu tưng ngừoi dùng thêm đoạn mã sau!!! if (para!=nil) { NSMutableArray *endcodeParaCompos =[[NSMutableArray alloc]init]; for (NSString *key in para) { [endcodeParaCompos addObject:[NSString stringWithFormat:@"%@=%@",key,para[key]]]; } NSData *encodeParas=[[endcodeParaCompos componentsJoinedByString:@"&"] dataUsingEncoding:NSUTF8StringEncoding]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; [request setValue:[NSString stringWithFormat:@"%d",(int)encodeParas.length] forHTTPHeaderField:@"ContentLength"]; request.HTTPBody=encodeParas; 10 } Kiểm tra có para , ta truyền tham số đoạn mã truyền tham số quy định tuân theo, Khởi tạo mảng để lưu key value theo định dạng %@=%@ chuyển đổi para sang NSData application/x-www-form-urlencoded kiểu hiển thị phổ biến cuối cung gửi para đoạn mã thêm vào sau xet method, đầy đủ trông sau: -(void)urlSession:(NSDictionary *)para urlApi:(NSString*)urlApi{ NSURL *url=[NSURL URLWithString:urlApi]; NSMutableURLRequest *request= [NSMutableURLRequest requestWithURL:url]; [request setHTTPMethod:@"POST"]; if (para!=nil) { NSMutableArray *endcodeParaCompos =[[NSMutableArray alloc]init]; for (NSString *key in para) { [endcodeParaCompos addObject:[NSString stringWithFormat:@"%@=%@",key,para[key]]]; } NSData *encodeParas=[[endcodeParaCompos componentsJoinedByString:@"&"] dataUsingEncoding:NSUTF8StringEncoding]; 11 [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; 10 12 [request setValue:[NSString stringWithFormat:@"%d",(int)encodeParas.length] forHTTPHeaderField:@"Content- Length"]; 13 request.HTTPBody=encodeParas; 14 } 15 16 NSURLSessionDataTask *task=[[NSURLSession sharedSession]dataTaskWithRequest:request completionHandler:^(NSData * data, NSURLResponse *response, NSError *error) { 17 NSError *errorData; 18 if (error==nil) { 19 NSDictionary *conten=[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments 20 21 22 23 24 25 26 27 28 error:&errorData]; if (errorData==nil) { NSLog(@"%@",conten); }else{ NSString *contenError=[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"%@",contenError); } } }]; [task resume]; 29 } truyền tham số hiep: - (IBAction)session{ NSString *strUrl=@"https://ionic-songhop.herokuapp.com/login"; NSDictionary *key=@{@"username":@"hiep"}; [self urlSession:key urlApi:strUrl]; } Biên dịch chạy ta NSLog kết quả: 2016-05-23 11:13:06.052 Json[1038:45980] { 10 11 12 13 14 15 16 17 18 favorites = ( { artist = Brandy; "image_large" = "https://i.scdn.co/image/8a161e85351a20aaf4f4099cc89e1b8fb726e035"; "image_medium" = "https://i.scdn.co/image/3f3b3c7e4d4feabb73c885b38500d1427260ae33"; "image_small" = "https://i.scdn.co/image/4dcf0d5722e62cdfaf620a773f010e6b2dd15b78"; "open_url" = "https://open.spotify.com/track/6esN4GvN6uRe1SVVNElHDq"; "preview_url" = "https://p.scdn.co/mp3-preview/33add4c82a52fbaf7665b8dee3da1c73b2406775"; "song_id" = 54dd0bc8a57fa90c00770523; title = "I Wanna Be Down - Single Version"; }, { artist = "Destiny's Child"; "image_large" = "https://i.scdn.co/image/bf0f79acd50add01e88575664fe98d8d44d3123f"; "image_medium" = "https://i.scdn.co/image/a7aef2e8232955bb94d7c041a0fbc06b2bb8fe7f"; "image_small" = "https://i.scdn.co/image/fdf76dbe620b71af39d775274795c0ca2829c19f"; "open_url" = "https://open.spotify.com/track/72oq9xR8MK5CLpI185xaVy"; 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 "preview_url" = "https://p.scdn.co/mp3-preview/ca5baaecfef5ce51277e105f71a8d63240b734d8"; "song_id" = 54dd0bc8a57fa90c00770606; title = Survivor; }, { artist = Fischerspooner; "image_large" = "https://i.scdn.co/image/bbae0384d6c3003efe6b913320be17d2236a7ed9"; "image_medium" = "https://i.scdn.co/image/2e1a1eca7d08deead66e837e07cc434fe8b0262d"; "image_small" = "https://i.scdn.co/image/f2e566ac0da74bbb65bb0d734a7b8a3366bf4997"; "open_url" = "https://open.spotify.com/track/4etezwvjIhth11BG1SGCgs"; "preview_url" = "https://p.scdn.co/mp3-preview/198d749dbeffcbe3e2a63c3d85f0b07fb9539e35"; "song_id" = 54dd0bc8a57fa90c007705ba; title = "Never Win"; }, { artist = "Kid Sister"; "image_large" = "https://i.scdn.co/image/a4342e2a38b294db0775d699138af0902fabf25f"; "image_medium" = "https://i.scdn.co/image/5b17e76a08d1577d900454c4ad2a68313245aa13"; "image_small" = "https://i.scdn.co/image/3d1c9c17285ffbc91c97d865f6c7e63edfb972c2"; "open_url" = "https://open.spotify.com/track/7gjsO6qOYqTEXqZJrbIaOG"; "preview_url" = "https://p.scdn.co/mp3-preview/3edf28271aaa8dbe07496c0f341633d91e779723"; "song_id" = 54dd0bc8a57fa90c0077062b; title = Control; }, { artist = "Ellie Goulding"; "image_large" = "https://i.scdn.co/image/1a3ca29c2f93fa50f72df85b1a94f62383dbc5cd"; "image_medium" = "https://i.scdn.co/image/253be50ddceb82345cc02d13f68711b1de185936"; "image_small" = "https://i.scdn.co/image/84496c2807804327b59add2b6bd3957badf74083"; "open_url" = "https://open.spotify.com/track/6Ks02PwRawUTDwGyboe0Fc"; "preview_url" = "https://p.scdn.co/mp3-preview/4af7f000411b8959efb6ca6530157752f362abcd"; "song_id" = 54dd0bc8a57fa90c00770574; title = "Lights (Single Version)"; }, { artist = Ladyhawke; "image_large" = "https://i.scdn.co/image/a7d927e5fc59da3923d06d61b7649c0144561481"; "image_medium" = "https://i.scdn.co/image/845665ec2f35b397c44464f4b8e183faaf11550c"; "image_small" = "https://i.scdn.co/image/b1037dc2edcf2b4e2c8624e7591580e1d46bd9c7"; "open_url" = "https://open.spotify.com/track/5eStaIpPvDJCMrWELkSAp5"; "preview_url" = "https://p.scdn.co/mp3-preview/dad0c35fa3953a720208f1d6d0231c68a139e7db"; "song_id" = 54dd0bc8a57fa90c007705c7; title = "Back Of The Van"; }, { artist = "Luther Vandross"; "image_large" = "https://i.scdn.co/image/b2210635a2334ffbba99792888b5a4d25041c228"; "image_medium" = "https://i.scdn.co/image/499e378a14c8d66601cb764b8b2cd17aa1b82b89"; "image_small" = "https://i.scdn.co/image/d2b34a04398f4b42236191fab1cc91996577d286"; "open_url" = "https://open.spotify.com/track/3Bb9jzYKHSOmEM1tikLd6V"; "preview_url" = "https://p.scdn.co/mp3-preview/3660756c15a4741a9b0671c512b8ce8084eb4590"; "song_id" = 54dd0bc8a57fa90c00770641; title = "Dance With My Father"; 72 }, 73 { 74 artist = "Ne-Yo"; 75 "image_large" = "https://i.scdn.co/image/00a3bb46c61c035ddb47502b71da4f062c82804d"; 76 "image_medium" = "https://i.scdn.co/image/149d0bbd504d0c919da20152636c5dbc8cbb365b"; 77 "image_small" = "https://i.scdn.co/image/a5e4ed0bc57c4664bb1c8720cc9f7adefd35dca0"; 78 "open_url" = "https://open.spotify.com/track/2dQAJjOAePdj8hLE88Qp5L"; 79 "preview_url" = "https://p.scdn.co/mp3-preview/db2e8fbdb875b4c6fca354d2831fe050317edb7f"; 80 "song_id" = 54dd0bc8a57fa90c007704fe; 81 title = "Miss Independent"; 82 }, 83 { 84 artist = "Brooks & Dunn"; 85 "image_large" = "https://i.scdn.co/image/aec75b35408f3d3371d183f94adf872c39d04ba3"; 86 "image_medium" = "https://i.scdn.co/image/a83cfbb35e373129720883eefc750fa11b269108"; 87 "image_small" = "https://i.scdn.co/image/1336210e9131e57c69e82967def09d45f4b38d1a"; 88 "open_url" = "https://open.spotify.com/track/09qzRI951OVkXGCc33gzcT"; 89 "preview_url" = "https://p.scdn.co/mp3-preview/a3405fc8f47de7e9e06a49b8293668dd554af401"; 90 "song_id" = 54dd0bc8a57fa90c007704e3; 91 title = "My Maria"; 92 }, 93 { 94 artist = "Mila J"; 95 "image_large" = "https://i.scdn.co/image/93df01f3f7b2080f924b0c4890a82751e16fa8aa"; 96 "image_medium" = "https://i.scdn.co/image/e97f7b416871f420377e58f1d6d7dec13d7ccb59"; 97 "image_small" = "https://i.scdn.co/image/f12516b1e7d165c403a41dfb7a931741a17041b1"; 98 "open_url" = "https://open.spotify.com/track/7slZeIUsewMBnkMXT1RWoh"; 99 "preview_url" = "https://p.scdn.co/mp3-preview/02816213ba85a87b87f1fead3297448684298988"; 100 "song_id" = 54dd0bc8a57fa90c00770601; 101 title = "Smoke, Drink, Break-Up"; 102 }, 103 { 104 artist = "Luke Bryan"; 105 "image_large" = "https://i.scdn.co/image/beb2a1636debd37a16c03a787ea962add845eccb"; 106 "image_medium" = "https://i.scdn.co/image/045e857dc7d9643ed309fc0b3c5c1bb9d6fe427d"; 107 "image_small" = "https://i.scdn.co/image/36dad0b9096e1da60518b851eb6a3ca6942143cf"; 108 "open_url" = "https://open.spotify.com/track/3xn2DXsMWxeJKNiG6IYZsk"; 109 "preview_url" = "https://p.scdn.co/mp3-preview/779229ac7ca042ce3c2a4d710458665a4c3e4e44"; 110 "song_id" = 54dd0bc8a57fa90c007704c8; 111 title = "What Country Is"; 112 }, 113 { 114 artist = Alesso; 115 "image_large" = "https://i.scdn.co/image/33708105136c9c996aba5c7f75a55c5e412adfe1"; 116 "image_medium" = "https://i.scdn.co/image/50425bd18161ae9ca646c6286c8fa2bbf2026569"; 117 "image_small" = "https://i.scdn.co/image/f31193dec0fef99fdb6383e618d29c2bea051942"; 118 "open_url" = "https://open.spotify.com/track/7rwaGOl65pF5TtW0CxV3HJ"; 119 "preview_url" = "https://p.scdn.co/mp3-preview/948ac7e96bc2f9ca2280fbab8ffb9f0943d50788"; 120 "song_id" = 54dd0bc8a57fa90c00770639; 121 title = "If I Lose Myself"; 122 }, 123 { 124 artist = "Marc Ribot"; 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 "image_large" = "https://i.scdn.co/image/1606d9ec7ff6c90bd4cf26546a02aab0054d337a"; "image_medium" = "https://i.scdn.co/image/582f04eed1e9a87aa33667dddcb4f784c56030a1"; "image_small" = "https://i.scdn.co/image/8eb8ffb9a55516a8d324626b288c5c3e0dea31c6"; "open_url" = "https://open.spotify.com/track/6AMnK19NuloZd3SP78mNic"; "preview_url" = "https://p.scdn.co/mp3-preview/950c0b08bf6140b47818f5a382d1cdf3570d3859"; "song_id" = 54dd0bc8a57fa90c007705f5; title = Bateau; }, { artist = "Trace Adkins"; "image_large" = "https://i.scdn.co/image/5623dd558033082bdee23baee062b3860e2dc9de"; "image_medium" = "https://i.scdn.co/image/3729ec348ff835cd3b8d7d05825dfa1f49c375d2"; "image_small" = "https://i.scdn.co/image/01bec368c5c874934000205803c5febe12374c7f"; "open_url" = "https://open.spotify.com/track/7l2mYsNQu8zxQ54mcsiXMX"; "preview_url" = "https://p.scdn.co/mp3-preview/edce600d6ace9367fc12b2a9c873ef08023bf6e6"; "song_id" = 54dd0bc8a57fa90c007704e1; title = Swing; }, { artist = "The Naked And Famous"; "image_large" = "https://i.scdn.co/image/4b8100bab1d9590097b67550777ecef07e78997a"; "image_medium" = "https://i.scdn.co/image/8130d5a147ee9792cff7a9a23376ac56ff45a01b"; "image_small" = "https://i.scdn.co/image/962a6b9cec416d4b1a683481fa92f6caeac99f2b"; "open_url" = "https://open.spotify.com/track/25pnOZSMwZBU7PAgaDS5yi"; "preview_url" = "https://p.scdn.co/mp3-preview/6e4990a23ebf97f00016d2f670da0065164c2e67"; "song_id" = 54dd0bc8a57fa90c00770555; title = "Young Blood"; }, { artist = "Gwen Stefani"; "image_large" = "https://i.scdn.co/image/5e1c2c47bab93b8d2db21d6fd96f6a7f1d167bff"; "image_medium" = "https://i.scdn.co/image/0b49d63cad634f967cda9e786abc1496ad6457bf"; "image_small" = "https://i.scdn.co/image/d3ff468f81747eae2bf854e65eaafc596dd5d286"; "open_url" = "https://open.spotify.com/track/5WguijCseCBLdm67oK6wxQ"; "preview_url" = "https://p.scdn.co/mp3-preview/839903b38c82726f4a2a48fa90f5b43e75e13f2c"; "song_id" = 54dd0bc8a57fa90c00770531; title = "Hollaback Girl"; }, { artist = Dio; "image_large" = "https://i.scdn.co/image/dd09f80774d71a6bf6d9e64b883b817617399f8a"; "image_medium" = "https://i.scdn.co/image/b2957d55a6edc4f7c6e89fca8acea036f6179ac0"; "image_small" = "https://i.scdn.co/image/e19e63a60bd554e4b450f884fb370ad143e8de3d"; "open_url" = "https://open.spotify.com/track/4w3aNK1WlBwSLtIA0oyLBt"; "preview_url" = "https://p.scdn.co/mp3-preview/f19c85405fa046aec012b16a8bd37fe2847a5006"; "song_id" = 54dd0bc8a57fa90c0077065e; title = "We Rock"; }, { artist = "Florida Georgia Line"; "image_large" = "https://i.scdn.co/image/83cea4f107695769d107ed2cb214f3ec6908a1bd"; "image_medium" = "https://i.scdn.co/image/a99db44ed24fa2d9ad6dbebeff5fc0cf878b89b6"; "image_small" = "https://i.scdn.co/image/586fa6b478fde2705f57f0665ace2d474c7a2678"; 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 "open_url" = "https://open.spotify.com/track/1XPMs9Qm63aOGZ7l0vYgy5"; "preview_url" = "https://p.scdn.co/mp3-preview/b6fcb34a4982db2b04aad60e37e2d8c502a189eb"; "song_id" = 54dd0bc8a57fa90c00770595; title = "Round Here"; }, { artist = "Angel Haze"; "image_large" = "https://i.scdn.co/image/6f9e0ffe9c9e5419f94c6393d431fcc936a63cf9"; "image_medium" = "https://i.scdn.co/image/25bc68682340006926a27ad8f5485ef592131b48"; "image_small" = "https://i.scdn.co/image/7521c80c241c579a9ea37e4366df9774c6108f54"; "open_url" = "https://open.spotify.com/track/5NkVKO5bGag9F4BARCZk3H"; "preview_url" = "https://p.scdn.co/mp3-preview/05e8647fee917ab464850cdb6fa1ff2798ee2bc4"; "song_id" = 54dd0bc8a57fa90c0077061c; title = "Werkin' Girls"; }, { artist = "R Kelly"; "image_large" = "https://i.scdn.co/image/25e552b5f8731e513db2d4d0a1aab327e3d949bc"; "image_medium" = "https://i.scdn.co/image/be2928b658a74b815624b089a3808eb660ffd3bb"; "image_small" = "https://i.scdn.co/image/3f388a9364ef0e8188873f4f5aa068840f2d7dee"; "open_url" = "https://open.spotify.com/track/6gHpWdXP2cgOhCt4Qe1txI"; "preview_url" = "https://p.scdn.co/mp3-preview/1f5d6ca2269714055674a8a75a86ae9d9e1f931d"; "song_id" = 54dd0bc8a57fa90c00770524; title = "When A Woman's Fed Up"; }, { artist = "Florence + The Machine"; "image_large" = "https://i.scdn.co/image/49cb3777297b69bb88c82abe1ea0d9ae8591ba13"; "image_medium" = "https://i.scdn.co/image/c68c814e2d5bac478d89060e1221d584dd64afa5"; "image_small" = "https://i.scdn.co/image/abe9a6ee3a6fe58442e05f63e6d0f68ef6ed85b4"; "open_url" = "https://open.spotify.com/track/7mpSKT7h6p12YqppsvbMGw"; "preview_url" = "https://p.scdn.co/mp3-preview/66ea51007160acf9ae53ebf1cf0bca15b4ff865a"; "song_id" = 54dd0bc8a57fa90c00770564; title = "Shake It Out"; }, { artist = Dio; "image_large" = "https://i.scdn.co/image/dd09f80774d71a6bf6d9e64b883b817617399f8a"; "image_medium" = "https://i.scdn.co/image/b2957d55a6edc4f7c6e89fca8acea036f6179ac0"; "image_small" = "https://i.scdn.co/image/e19e63a60bd554e4b450f884fb370ad143e8de3d"; "open_url" = "https://open.spotify.com/track/7zfELzsiLpEy1qGGdTHbYL"; "preview_url" = "https://p.scdn.co/mp3-preview/47a1a30bc67aa42f1762de71504cc83e55269c4d"; "song_id" = 54dd0bc8a57fa90c0077064c; title = "The Last In Line"; }, { artist = Journey; "image_large" = "https://i.scdn.co/image/b06e3c992e0f5c8b1333156f6c6e970c63979831"; "image_medium" = "https://i.scdn.co/image/99ca079c3e371e25d85e5fa3c0bb4c0507e2e340"; "image_small" = "https://i.scdn.co/image/a96dc5a85b6fca75c953ecffb68ff7822899294a"; "open_url" = "https://open.spotify.com/track/0SX3NGWlnGuVrp7bx0TaW3"; "preview_url" = "https://p.scdn.co/mp3-preview/5143697bf4ecc4edebab728edcc359bd3558ebb6"; "song_id" = 54dd0bc8a57fa90c007704c5; 231 232 233 234 235 title = "Separate Ways"; } ); "session_id" = 56c440c9e747e31100274a86; username = hiep; 236 } Như phần giúp bạn đọc json : link full: http://www.mediafire.com/download/p2f0202xbkbbbfw/Json+2.zip [...]... 54dd0bc8a57fa90c007704c5; 231 232 233 234 235 title = "Separate Ways"; } ); "session_id" = 56c440c9e747e31100274a86; username = hiep; 236 } Như vậy phần này đã giúp các bạn đọc được json : link full: 1 http://www.mediafire.com/download/p2f0202xbkbbbfw /Json+ 2.zip