Save as json rather than xml

Json processing is relatively simple and fast. Hence, json is favoured. Saving
as xml is still present but not used. Also made changes to remove redundant
codes and use default variables.

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>