optimize json and for