Convolutional neural networks (CNNs) have been commonly used in medical decision support systems to predict and diagnose different diseases with good precision. CNNs are extremely successful in developing health support systems because of their ability to identify relationships and hidden patterns in healthcare data. One of the most important and useful applications of such systems is in the prediction of heart diseases by observing cardiac anomalies. Fundamentally, CNNs have multiple hyperparameters and various specific architectures, which are costly and impose challenges in selecting the best value among possible hyperparameters. In addition, CNNs are sensitive to their hyperparameter values which have a significant impact on the efficiency and behavior of CNN architectures. Thus, selecting the right set of parameters is of particular concern among practitioners. Consequently, this paper proposes a CNN-jSO approach for the prediction of heart (cardiac) diseases, in which the jSO optimization algorithm is employed to tune those CNN hyperparameters. The performance of the designed system is tested on the PhysioNet heart sound and Kaggle heartbeat sounds datasets. The proposed CNN-jSO is compared with other algorithms and shown to be better than them. The CNN-jSO system was implemented in Python and yielded 97.76% training accuracy and 94.12% testing accuracy.