We describe an algorithm, based on the properties of the characteristic polynomials of Frobenius, to compute End K (A) when A is the Jacobian of a nice genus-2 curve over a number field K. We use this algorithm to confirm that the description of the structure of the geometric endomorphism ring of Jac(C) given in the LMFDB (L-functions and modular forms database) is correct for all the genus 2 curves C currently listed in it. We also discuss the determination of the field of definition of the endomorphisms in some special cases.compute the structure of End Q (Jac(C)) for all the genus-2 curves admitting an odddegree model with small coefficients and for all the curves considered in the recent computational effort [BSS + 16]. In all cases our findings are in agreement with the data recorded in the [LMFDB], see section 8.