refactor code
suport json and yaml