Add a function to flatten array
Flatten 'fields' option