Optimization of function localJSON