In the years to come, the Javalambre-Physics of the Accelerated Universe Astrophysical Survey (J-PAS) will observe 8000 deg2 of the northern sky with 56 photometric bands. J-PAS is ideal for the detection of nebular emission objects. This paper presents a new method based on artificial neural networks (ANNs) that is aimed at measuring and detecting emission lines in galaxies up to z = 0.35. These lines are essential diagnostics for understanding the evolution of galaxies through cosmic time. We trained and tested ANNs with synthetic J-PAS photometry from CALIFA, MaNGA, and SDSS spectra. To this aim, we carried out two tasks. First, we clustered galaxies in two groups according to the values of the equivalent width (EW) of Hα, Hβ, [N II], and [O III] lines measured in the spectra. Then we trained an ANN to assign a group to each galaxy. We were able to classify them with the uncertainties typical of the photometric redshift measurable in J-PAS. Second, we utilized another ANN to determine the values of those EWs. Subsequently, we obtained the [N II]/Hα, [O III]/Hβ, and O 3N 2 ratios, recovering the BPT diagram ([O III]/Hβ versus [N II]/Hα). We studied the performance of the ANN in two training samples: one is only composed of synthetic J-PAS photo-spectra (J-spectra) from MaNGA and CALIFA (CALMa set) and the other one is composed of SDSS galaxies. We were able to fully reproduce the main sequence of star-forming galaxies from the determination of the EWs. With the CALMa training set, we reached a precision of 0.092 and 0.078 dex for the [N II]/Hα and [O III]/Hβ ratios in the SDSS testing sample. Nevertheless, we find an underestimation of those ratios at high values in galaxies hosting an active galactic nuclei. We also show the importance of the dataset used for both training and testing the model. Such ANNs are extremely useful for overcoming the limitations previously expected concerning the detection and measurements of the emission lines in such surveys as J-PAS. Furthermore, we show the capability of the method to measure a EW of 10 Å in Hα, Hβ, [N II] and [O III] lines with a signal-to-noise ratio (S/N) of 5, 1.5, 3.5, and 10, respectively, in the photometry. Finally, we compare the properties of emission lines in galaxies observed with miniJPAS and SDSS. Despite the limitation of such a comparison, we find a remarkable correlation in their EWs.