Properly cast json to array.

See http://codepad.org/CJy32qQD