data=[{"Content": "How to walk into the heart of mentally handicapped children", "title": "How to walk into the heart of mentally handicapped children", "second": 27, "Name": "Basic Course", "categoryId": "CourseID": 292, "Noteid": 143, "type": 1, "date": "11-23", "Specialid": 186}, {"Content": "The child's sense of security, not only the spiritual needs, but also the object The quality. So try to make a good example to your child. "," title ":" How to build a child's sense of security "," second ": 0," name ":" Basic Course "," CategoryId ": 5, "CourseID": 818, "Noteid":, "type": 1, "date": "11-21", "Specialid": 172}, {"Content": "Guide children to learn to Thanksgiving parents, honesty for people, integrity work." "," title ":" "topic overview" Guide children to learn to Thanksgiving parents, honest people, integrity, "second": 0, "name": "Basic Course", "Catego Ryid ": 5," CourseID ": 817," Noteid ": 129," type ": 1," Specialid ": 172} ] Console.log (data.length); var team_date = []; var indexs =-1; Data.foreach (function (i,x) {console.log (i.date); if (i.date) {var team = {aa: ', list: []} indexs++; Team.date=i.date; Team.list.push (i); Team_date.push (team); }else{Team_date[indexs].list.push (i); } })
Http://jsrun.net/CGiKp/edit Online Case
JSON structure changes the way the data is sorted by date