Download JSON-file.

Good afternoon.
Could You tell me, how to download JSON-file with some data from client's computer.

http://jsfiddle.net/cowboy/hHZa9/

Use this to download JSON-file.

var obj = {a: 123, b: "4 5 6"};
var data = "text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(obj));

$('<a href="data:' + data + '" download="data.json">download JSON</a>').appendTo('#container');