We propose a new quantization method for superconducting electronic circuits involving a Josephson-junction device coupled to a linear microwave environment. The method is based on an exact impedance synthesis of the microwave environment considered as a blackbox with impedance function Z(s). The synthesized circuit captures dissipative dynamics of the system with resistors coupled to the reactive part of the circuit in a nontrivial way. We quantize the circuit and compute relaxation rates following previous formalisms for lumped element circuit quantization. Up to the errors in the fit our method gives an exact description of the system and its losses.