updated write json scripts