I sending ajax request from a jQuery file like below, which expects response in JSON.
jQuery.ajax({ url: \'/Control/getImageDetails?file_id=\'+currentId,
Encode it using the functions in the json module.