Set JSON on window inside closure