How to generate JSON response