If your data really is in that format, you can add an extra set of brackets around the whole thing to read it in as an array literal. Just be sure that the data source is trustworthy and you if you're going to eval it! If you aren't generating or strongly filtering the inputs this is probably a bad idea. irb> input = "[25.0, 26], [30, 31]" => "[25.0, 26], [30, 31]" irb> input = "[" + input + "]" => "[[25.0, 26], [30, 31]]" irb> eval input => [[25.0, 26], [30, 31]] irb> result = eval input => [[25.0, 26], [30, 31]] irb> result[0][1] => 26 But maybe you were just simplifying the input data format to present the problem?