add local storage function with JSON