adding json outside function