moved json handler into single class