Context. Neutron stars are currently studied with an rising number of electromagnetic and gravitational-wave observations, which will ultimately allow us to constrain the dense matter equation of state and understand the physical processes at work within these compact objects. Neutron star global parameters, such as the mass and radius, can be used to obtain the equation of state by directly inverting the Tolman-Oppenheimer-Volkoff equations. Here, we investigate an alternative approach to this procedure. Aims. The aim of this work is to study the application of the artificial neural networks guided by the autoencoder architecture as a method for precisely reconstructing the neutron star equation of state, using their observable parameters: masses, radii, and tidal deformabilities. In addition, we study how well the neutron star radius can be reconstructed using only the gravitational-wave observations of tidal deformability, that is, using quantities that are not related in any straightforward way. Methods. The application of an artificial neural network in the equation-of-state reconstruction exploits the non-linear potential of this machine learning model. Since each neuron in the network is basically a non-linear function, it is possible to create a complex mapping between the input sets of observations and the output equation-of-state table. Within the supervised training paradigm, we construct a few hidden-layer deep neural networks on a generated data set, consisting of a realistic equation of state for the neutron star crust connected with a piecewise relativistic polytropes dense core, with its parameters representative of state-of-the art realistic equations of state. Results. We demonstrate the performance of our machine-learning implementation with respect to the simulated cases with a varying number of observations and measurement uncertainties. Furthermore, we study the impact of the neutron star mass distributions on the results. Finally, we test the reconstruction of the equation of state trained on parametric polytropic training set using the simulated mass–radius and mass–tidal-deformability sequences based on realistic equations of state. Neural networks trained with a limited data set are capable of generalising the mapping between global parameters and equation-of-state input tables for realistic models.