updated create json to accomodate exiting file

also added encoding