generate a json array, when pressing save button