formatted and encoded galleries -> images array into JSON