 if opacity:
      svg = re.sub(&#34;rect style=&#39;opacity:[^\;]+;&#34;,
                   &#34;rect style=&#39;opacity:{};&#34;.format(opacity),svg)
    return svg
  
class ChemJson(ChemSVG,Svg2Json):
  def __init__(self,*args,**kwargs):
      ChemSVG.__init__(self,*args,**kwargs)
      Svg2Json.__init__(self,*args,**kwargs)
  
  def __call__(self,smi,**kwargs):
    return self.smi2json(smi,**kwargs)
  
  def smi2json(self,smi,**kwargs):
    svg = self.smi2svg(smi,**kwargs)
    return self.read_svg(svg)