Return the search results in JSON format, if such a format is requested.