json finished,few more refactorings