0

The string is of the form

{"session":"a24186c2-5536-1734-42cc-3eb50e625964","time":1392862093110,"prettyTime":"Wed Feb 19 2014 21:08:13 GMT-0500 (EST)","timeDrift":0,"event":"Started session"},{"session":"a24186c2-5536-1734-42cc-3eb50e625964","time":1392844105595,"prettyTime":"Wed Feb 19 2014 16:08:25 GMT-0500 (EST)","timeDrift":-18000293.5,"event":"User logged in","parameters":{"username":"s1group1","firstName":"student","lastName":"1group1","className":"dragon"}},{"session":"71ffa2dc-ffec-9276-063f-82cd4bd43c70","time":1392844138219,"prettyTime":"Wed Feb 19 2014 16:08:58 GMT-0500 (EST)","timeDrift":-18000402.5,"event":"User logged in","parameters":{"username":"s1group1","firstName":"student","lastName":"1group1","className":"dragon"}},{"session":"71ffa2dc-ffec-9276-063f-82cd4bd43c70","time":1392862136734,"prettyTime":"Wed Feb 19 2014 21:08:56 GMT-0500 (EST)","timeDrift":0,"event":"Started session"},{"session":"6f3fe618-b934-a66a-aae4-5193d9106535","time":1392862145281,"prettyTime":"Wed Feb 19 2014 21:09:05 GMT-0500 (EST)","timeDrift":0,"event":"Started session"},{"session":"6f3fe618-b934-a66a-aae4-5193d9106535","time":1392844147075,"prettyTime":"Wed Feb 19 2014 16:09:07 GMT-0500 (EST)","timeDrift":-18000245,"event":"Moved to","parameters":{"title":"Office"}},{"session":"6f3fe618-b934-a66a-aae4-5193d9106535","time":1392844147067,"prettyTime":"Wed Feb 19 2014 16:09:07 GMT-0500 (EST)","timeDrift":-18000245,"event":"User logged in","parameters":{"username":"s1group1","firstName":"student","lastName":"1group1","className":"dragon"}},{"session":"6f3fe618-b934-a66a-aae4-5193d9106535","time":1392844150345,"prettyTime":"Wed Feb 19 2014 16:09:10 GMT-0500 (EST)","timeDrift":-18000245,"event":"User logged out"},{"session":"6f3fe618-b934-a66a-aae4-5193d9106535","time":1392844150346,"prettyTime":"Wed Feb 19 2014 16:09:10 GMT-0500 (EST)","timeDrift":-18000245,"event":"Ended session"},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392908888831,"prettyTime":"Thu Feb 20 2014 10:08:08 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Started session"},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392908888831,"prettyTime":"Thu Feb 20 2014 10:08:08 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"User logged in","parameters":{"username":"s1group1","firstName":"student","lastName":"1group1","className":"dragon"}},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392908892346,"prettyTime":"Thu Feb 20 2014 10:08:12 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Moved to","parameters":{"title":"Case Log"}},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392908896382,"prettyTime":"Thu Feb 20 2014 10:08:16 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Moved to","parameters":{"title":"Case 2: Challenge 1"}},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392908896382,"prettyTime":"Thu Feb 20 2014 10:08:16 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Started challenge","parameters":{"title":"Case 2: Challenge 1","route":"case2/challenge1","case":1,"challenge":2}},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392908896601,"prettyTime":"Thu Feb 20 2014 10:08:16 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Opened info"},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392908898233,"prettyTime":"Thu Feb 20 2014 10:08:18 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Closed info"},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392908899921,"prettyTime":"Thu Feb 20 2014 10:08:19 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Selected parent","parameters":{"alleles":"a:T,b:T,a:m,b:m,a:w,b:w,a:h,b:h,a:C,b:C,a:B,b:B,a:Fl,b:Fl,a:Hl,b:hl,a:A1,b:A1,a:D,b:D,a:Bog,b:Bog,a:rh,b:rh","sex":1}},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392908901545,"prettyTime":"Thu Feb 20 2014 10:08:21 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Completed meiosis","parameters":{"sex":1}},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392908902959,"prettyTime":"Thu Feb 20 2014 10:08:22 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Selected gamete","parameters":{"alleles":"T,m,w,h,C,B,Fl,Hl,A1,D,Bog,rh","sex":1}},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392909523246,"prettyTime":"Thu Feb 20 2014 10:18:43 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Moved to","parameters":{"title":"Case Log"}},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392909523265,"prettyTime":"Thu Feb 20 2014 10:18:43 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Closed info"},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392909525004,"prettyTime":"Thu Feb 20 2014 10:18:45 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Closed info"},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392909526551,"prettyTime":"Thu Feb 20 2014 10:18:46 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Moved to","parameters":{"title":"Case 13: Challenge 1"}},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392909526552,"prettyTime":"Thu Feb 20 2014 10:18:46 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Started challenge","parameters":{"title":"Case 13: Challenge 1","route":"case13/challenge1","case":1,"challenge":1}},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392909526557,"prettyTime":"Thu Feb 20 2014 10:18:46 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Closed info"},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392909526825,"prettyTime":"Thu Feb 20 2014 10:18:46 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Closed info"},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392909526892,"prettyTime":"Thu Feb 20 2014 10:18:46 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Opened info"},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392909529014,"prettyTime":"Thu Feb 20 2014 10:18:49 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Closed info"},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392909530316,"prettyTime":"Thu Feb 20 2014 10:18:50 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Selected parent","parameters":{"alleles":"a:T,b:T,a:m,b:m,a:W,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:Hl,b:hl,a:A1,b:A1,a:D,b:D,a:Bog,b:Bog,a:Rh,b:Rh","sex":1}},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392909532339,"prettyTime":"Thu Feb 20 2014 10:18:52 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Selected parent","parameters":{"alleles":"a:T,b:T,a:m,b:m,a:w,b:w,a:H,b:H,a:C,b:C,a:B,b:B,a:Fl,b:Fl,a:Hl,b:Hl,a:A1,b:A1,a:D,a:Bog,a:Rh","sex":0}},{"session":"277515ea-7433-e097-48c5-ece5f9753303","time":1392909533840,"prettyTime":"Thu Feb 20 2014 10:18:53 GMT-0500 (EST)","timeDrift":-18005801.5,"event":"Bred dragons","parameters":{"mother":"a:T,b:T,a:m,b:m,a:W,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:Hl,b:hl,a:A1,b:A1,a:D,b:D,a:Bog,b:Bog,a:Rh,b:Rh","father":"a:T,b:T,a:m,b:m,a:w,b:w,a:H,b:H,a:C,b:C,a:B,b:B,a:Fl,b:Fl,a:Hl,b:Hl,a:A1,b:A1,a:D,a:Bog,a:Rh"}},{"session":"ccdf88d4-9928-c651-0c92-313e3d674227","time":1392909555848,"prettyTime":"Thu Feb 20 2014 10:19:15 GMT-0500 (EST)","timeDrift":-18005801,"event":"User logged in","parameters":{"username":"s1group1","firstName":"student","lastName":"1group1","className":"dragon"}},{"session":"ccdf88d4-9928-c651-0c92-313e3d674227","time":1392909554985,"prettyTime":"Thu Feb 20 2014 10:19:14 GMT-0500 (EST)","timeDrift":-18005801,"event":"Started session"},{"session":"ccdf88d4-9928-c651-0c92-313e3d674227","time":1392909555918,"prettyTime":"Thu Feb 20 2014 10:19:15 GMT-0500 (EST)","timeDrift":-18005801,"event":"Started challenge","parameters":{"title":"Case 13: Challenge 1","route":"case13/challenge1","case":1,"challenge":1}},{"session":"ccdf88d4-9928-c651-0c92-313e3d674227","time":1392909555917,"prettyTime":"Thu Feb 20 2014 10:19:15 GMT-0500 (EST)","timeDrift":-18005801,"event":"Moved to","parameters":{"title":"Case 13: Challenge 1"}},{"session":"ccdf88d4-9928-c651-0c92-313e3d674227","time":1392909556220,"prettyTime":"Thu Feb 20 2014 10:19:16 GMT-0500 (EST)","timeDrift":-18005801,"event":"Opened info"},{"session":"ccdf88d4-9928-c651-0c92-313e3d674227","time":1392909559565,"prettyTime":"Thu Feb 20 2014 10:19:19 GMT-0500 (EST)","timeDrift":-18005801,"event":"Closed info"},{"session":"47997fdf-02f2-e26f-b233-6fa5f6896ed3","time":1392927580329,"prettyTime":"Thu Feb 20 2014 15:19:40 GMT-0500 (EST)","timeDrift":0,"event":"Started session"},{"session":"47997fdf-02f2-e26f-b233-6fa5f6896ed3","time":1392909574938,"prettyTime":"Thu Feb 20 2014 10:19:34 GMT-0500 (EST)","timeDrift":-18005901.5,"event":"User logged in","parameters":{"username":"s1group1","firstName":"student","lastName":"1group1","className":"dragon"}},{"session":"47997fdf-02f2-e26f-b233-6fa5f6896ed3","time":1392909575005,"prettyTime":"Thu Feb 20 2014 10:19:35 GMT-0500 (EST)","timeDrift":-18005901.5,"event":"Started challenge","parameters":{"title":"Case 13: Challenge 1","route":"case13/challenge1","case":1,"challenge":1}},{"session":"47997fdf-02f2-e26f-b233-6fa5f6896ed3","time":1392909575004,"prettyTime":"Thu Feb 20 2014 10:19:35 GMT-0500 (EST)","timeDrift":-18005901.5,"event":"Moved to","parameters":{"title":"Case 13: Challenge 1"}},{"session":"47997fdf-02f2-e26f-b233-6fa5f6896ed3","time":1392909575283,"prettyTime":"Thu Feb 20 2014 10:19:35 GMT-0500 (EST)","timeDrift":-18005901.5,"event":"Opened info"},{"session":"47997fdf-02f2-e26f-b233-6fa5f6896ed3","time":1392909577439,"prettyTime":"Thu Feb 20 2014 10:19:37 GMT-0500 (EST)","timeDrift":-18005901.5,"event":"Closed info"},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393264714143,"prettyTime":"Mon Feb 24 2014 12:58:34 GMT-0500 (EST)","timeDrift":0,"event":"Started session"},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246740044,"prettyTime":"Mon Feb 24 2014 07:59:00 GMT-0500 (EST)","timeDrift":-18000716,"event":"User logged in","parameters":{"username":"s1group1","firstName":"student","lastName":"1group1","className":"dragon"}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246740057,"prettyTime":"Mon Feb 24 2014 07:59:00 GMT-0500 (EST)","timeDrift":-18000716,"event":"Moved to","parameters":{"title":"Office"}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246757111,"prettyTime":"Mon Feb 24 2014 07:59:17 GMT-0500 (EST)","timeDrift":-18000716,"event":"Moved to","parameters":{"title":"Case Log"}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246826601,"prettyTime":"Mon Feb 24 2014 08:00:26 GMT-0500 (EST)","timeDrift":-18000716,"event":"Started challenge","parameters":{"title":"Case 7: Challenge 1","route":"case7/challenge1","case":1,"challenge":1}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246827235,"prettyTime":"Mon Feb 24 2014 08:00:27 GMT-0500 (EST)","timeDrift":-18000716,"event":"Opened info"},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246826599,"prettyTime":"Mon Feb 24 2014 08:00:26 GMT-0500 (EST)","timeDrift":-18000716,"event":"Moved to","parameters":{"title":"Case 7: Challenge 1"}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246832961,"prettyTime":"Mon Feb 24 2014 08:00:32 GMT-0500 (EST)","timeDrift":-18000716,"event":"Closed info"},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246837613,"prettyTime":"Mon Feb 24 2014 08:00:37 GMT-0500 (EST)","timeDrift":-18000716,"event":"Opened info"},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246841872,"prettyTime":"Mon Feb 24 2014 08:00:41 GMT-0500 (EST)","timeDrift":-18000716,"event":"Closed info"},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246844062,"prettyTime":"Mon Feb 24 2014 08:00:44 GMT-0500 (EST)","timeDrift":-18000716,"event":"Opened info"},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246846333,"prettyTime":"Mon Feb 24 2014 08:00:46 GMT-0500 (EST)","timeDrift":-18000716,"event":"Closed info"},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246849025,"prettyTime":"Mon Feb 24 2014 08:00:49 GMT-0500 (EST)","timeDrift":-18000716,"event":"Bred dragons","parameters":{"mother":"a:T,b:T,a:m,b:m,a:W,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,b:D,a:Bog,b:Bog,a:rh,b:rh","father":"a:T,b:T,a:m,b:m,a:W,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,a:Bog,a:rh"}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246850499,"prettyTime":"Mon Feb 24 2014 08:00:50 GMT-0500 (EST)","timeDrift":-18000716,"event":"Bred dragons","parameters":{"mother":"a:T,b:T,a:m,b:m,a:W,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,b:D,a:Bog,b:Bog,a:rh,b:rh","father":"a:T,b:T,a:m,b:m,a:W,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,a:Bog,a:rh"}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246858866,"prettyTime":"Mon Feb 24 2014 08:00:58 GMT-0500 (EST)","timeDrift":-18000716,"event":"Changed allele","parameters":{"drakeId":1,"oldAlleles":"a:T,b:T,a:m,b:m,a:W,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,b:D,a:Bog,b:Bog,a:rh,b:rh","newAlleles":"a:T,b:T,a:m,b:M,a:W,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,b:D,a:Bog,b:Bog,a:rh,b:rh"}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246861397,"prettyTime":"Mon Feb 24 2014 08:01:01 GMT-0500 (EST)","timeDrift":-18000716,"event":"Bred dragons","parameters":{"mother":"a:T,b:T,a:m,b:M,a:W,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,b:D,a:Bog,b:Bog,a:rh,b:rh","father":"a:T,b:T,a:m,b:m,a:W,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,a:Bog,a:rh"}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246876642,"prettyTime":"Mon Feb 24 2014 08:01:16 GMT-0500 (EST)","timeDrift":-18000716,"event":"Changed allele","parameters":{"drakeId":2,"oldAlleles":"a:T,b:T,a:m,b:m,a:W,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,a:Bog,a:rh","newAlleles":"a:T,b:T,a:m,b:m,a:W,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:Fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,a:Bog,a:rh"}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246879950,"prettyTime":"Mon Feb 24 2014 08:01:19 GMT-0500 (EST)","timeDrift":-18000716,"event":"Bred dragons","parameters":{"mother":"a:T,b:T,a:m,b:M,a:W,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,b:D,a:Bog,b:Bog,a:rh,b:rh","father":"a:T,b:T,a:m,b:m,a:W,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:Fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,a:Bog,a:rh"}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246887521,"prettyTime":"Mon Feb 24 2014 08:01:27 GMT-0500 (EST)","timeDrift":-18000716,"event":"Opened info"},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246897648,"prettyTime":"Mon Feb 24 2014 08:01:37 GMT-0500 (EST)","timeDrift":-18000716,"event":"Closed info"},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246901125,"prettyTime":"Mon Feb 24 2014 08:01:41 GMT-0500 (EST)","timeDrift":-18000716,"event":"Changed allele","parameters":{"drakeId":1,"oldAlleles":"a:T,b:T,a:m,b:M,a:W,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,b:D,a:Bog,b:Bog,a:rh,b:rh","newAlleles":"a:T,b:T,a:m,b:M,a:W,b:w,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,b:D,a:Bog,b:Bog,a:rh,b:rh"}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246903972,"prettyTime":"Mon Feb 24 2014 08:01:43 GMT-0500 (EST)","timeDrift":-18000716,"event":"Changed allele","parameters":{"drakeId":1,"oldAlleles":"a:T,b:T,a:m,b:M,a:W,b:w,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,b:D,a:Bog,b:Bog,a:rh,b:rh","newAlleles":"a:T,b:T,a:m,b:M,a:w,b:w,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,b:D,a:Bog,b:Bog,a:rh,b:rh"}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246907580,"prettyTime":"Mon Feb 24 2014 08:01:47 GMT-0500 (EST)","timeDrift":-18000716,"event":"Changed allele","parameters":{"drakeId":2,"oldAlleles":"a:T,b:T,a:m,b:m,a:W,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:Fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,a:Bog,a:rh","newAlleles":"a:T,b:T,a:m,b:m,a:w,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:Fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,a:Bog,a:rh"}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246918302,"prettyTime":"Mon Feb 24 2014 08:01:58 GMT-0500 (EST)","timeDrift":-18000716,"event":"Changed allele","parameters":{"drakeId":1,"oldAlleles":"a:T,b:T,a:m,b:M,a:w,b:w,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,b:D,a:Bog,b:Bog,a:rh,b:rh","newAlleles":"a:T,b:T,a:m,b:m,a:w,b:w,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,b:D,a:Bog,b:Bog,a:rh,b:rh"}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246918188,"prettyTime":"Mon Feb 24 2014 08:01:58 GMT-0500 (EST)","timeDrift":-18000716,"event":"Moved to","parameters":{"title":"Case 7: Challenge 2"}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246918189,"prettyTime":"Mon Feb 24 2014 08:01:58 GMT-0500 (EST)","timeDrift":-18000716,"event":"Started challenge","parameters":{"title":"Case 7: Challenge 2","route":"case7/challenge2","case":7,"challenge":2}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246918195,"prettyTime":"Mon Feb 24 2014 08:01:58 GMT-0500 (EST)","timeDrift":-18000716,"event":"Closed info"},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246918492,"prettyTime":"Mon Feb 24 2014 08:01:58 GMT-0500 (EST)","timeDrift":-18000716,"event":"Changed allele","parameters":{"drakeId":2,"oldAlleles":"a:T,b:T,a:m,b:m,a:w,b:W,a:h,b:h,a:C,b:C,a:B,b:B,a:Fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,a:Bog,a:rh","newAlleles":"a:T,b:T,a:m,b:m,a:w,b:w,a:h,b:h,a:C,b:C,a:B,b:B,a:fl,b:fl,a:hl,b:hl,a:A1,b:A1,a:D,a:Bog,a:rh"}},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246918713,"prettyTime":"Mon Feb 24 2014 08:01:58 GMT-0500 (EST)","timeDrift":-18000716,"event":"Closed info"},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246918746,"prettyTime":"Mon Feb 24 2014 08:01:58 GMT-0500 (EST)","timeDrift":-18000716,"event":"Opened info"},{"session":"e8a14c99-b18a-20a5-1d7e-cea199a1f605","time":1393246932466,"prettyTime":"Mon Feb 24 2014 08:02:12 GMT-0500 (EST)","timeDrift":-18000716,"event":"Closed info"}

Now, I want to parse it and store the records in database. How can it be parsed effectively and what would be a good way to store parameters?

1 Answer 1

2

Just do using JSON::parse

require 'json'

JSON.parse(string)

Example :

require 'json'

string = '{"session":"a24186c2-5536-1734-42cc-3eb50e625964","time":1392862093110}'
JSON.parse(string)
# => {"session"=>"a24186c2-5536-1734-42cc-3eb50e625964", "time"=>1392862093110}

Update

as per your comment do as below :

require 'json'

string = '[{"session":"a24186c2-5536-1734-42cc-3eb50e625964","time":1392862093110},{"sessi‌​on":"a24186c2-5536-1734-42cc-3eb50e625964","time":1392862093110}]'

array = JSON.parse(string)
# => [{"session"=>"a24186c2-5536-1734-42cc-3eb50e625964",
#      "time"=>1392862093110},
#     {"sessi‌​on"=>"a24186c2-5536-1734-42cc-3eb50e625964",
#      "time"=>1392862093110}]

array.each do |a|
  # your code
  puts a
end

# >> {"session"=>"a24186c2-5536-1734-42cc-3eb50e625964", "time"=>1392862093110}
# >> {"sessi‌​on"=>"a24186c2-5536-1734-42cc-3eb50e625964", "time"=>1392862093110}
Sign up to request clarification or add additional context in comments.

4 Comments

But how should I split the data to separate individual json objects?
@Peeyush You have now Hash object from Json string. Now you can use Ruby's Hash API...
Let me try to clarify. Let's say data is {"session":"a24186c2-5536-1734-42cc-3eb50e625964","time":1392862093110},{"session":"a24186c2-5536-1734-42cc-3eb50e625964","time":1392862093110} How to separate the two parts in it?
Thanks for the help. This works! Now how should I access session value for a particular a. a[session] does not seem to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.