It was not immediately clear what caused the explosion. Local media showed footage of a special police unit standing by at the school.
Media outlets reported injuries to several people, with varying numbers, and said some had been taken to hospital. Reuters could not independently confirm the number of injuries.
Jakarta police did not immediately respond to a request for comment and the mayor's office, district and national police could not immediately be reached.
News channels KompasTV and MetroTV showed footage of a police line around the school with ambulances standing by. Images of the mosque showed no extensive damage.
(Reporting by Jakarta bureau; Editing by David Stanway, Martin Petty)

A general view of the skyline in Jakarta, Indonesia, 02 May 2019. Indonesia plans to set up a new capital city as Jakarta struggles with bad traffic, pollution and flooding. The new location is not yet known. EPA/MAST IRHAM