Skip to main content
5 of 5
added 29 characters in body
Ajax1234
  • 7.7k
  • 1
  • 15
  • 28

Python3, 136 bytes:

import re
f=lambda x:x.translate(str.maketrans({'{':'[','}':']','[':'',']':''}))if x==(x:=re.sub('\[([\w\{\}]+)*\]','{\\1}',x))else f(x)

Try it online!

Ajax1234
  • 7.7k
  • 1
  • 15
  • 28