Proper use of json parsing