added JSONfile writing