Formatting JSON response on the last endpoint