JSON Serialization song information
I've been able to serialize dictionary before but am not sure how to go
about serializing multiple pieces of data.
I want to serialize song information, how would I go about doing this for
multiple songs? The code I have to output the strings are:
NSArray *songs = [playlist items];
for (MPMediaItem *song in songs){
NSString *title =[song valueForProperty: MPMediaItemPropertyTitle];
NSString *artist =[song valueForProperty:
MPMediaItemPropertyAlbumArtist];
NSString *album =[song valueForProperty:
MPMediaItemPropertyAlbumTitle];
NSString *length =[song valueForProperty:
MPMediaItemPropertyPlaybackDuration];
NSLog(@"Title: %@\nArtist: %@\nAlbum: %@\nLength:
%@",title,artist,album,length);
}
I don't know how to separate this in the JSON for every song.
No comments:
Post a Comment