The problem isn't where you think it is.
Change
var y = "{a: function() {}, b: [function() {}] }";
to
var y = "({a: function() {}, b: [function() {}] })";
Or change the call to eval
to
var o = eval('('+y+')');
to avoid eval
thinking you pass a block instead of an object.