Context.With the development of new instrumentation providing measurements of solar photospheric vector magnetic fields, we need to develop our understanding of the effects of current density on coronal magnetic field configurations. Aims.The object is to understand the diverse and complex nature of coronal magnetic fields in active regions using a nonlinear force-free model. Methods.From the observed photospheric magnetic field we derive the photospheric current density for two active regions: one is a decaying active region with strong currents (AR8151), and the other is a newly emerged active region with weak currents (AR8210). We compare the three-dimensional structure of the magnetic fields for both active region when they are assumed to be either potential or nonlinear force-free. The latter is computed using a Grad-Rubin vector-potential-like numerical scheme. A quantitative comparison is performed in terms of the geometry, the connectivity of field lines, the magnetic energy and the magnetic helicity content. Results.For the old decaying active region the connectivity and geometry of the nonlinear force-free model include strong twist and strong shear and are very different from the potential model. The twisted flux bundles store magnetic energy and magnetic helicity high in the corona (about 50 Mm). The newly emerged active region has a complex topology and the departure from a potential field is small, but the excess magnetic energy is stored in the low corona and is enough to trigger powerful flares.