refactored search criterion json code