Remove explicit json dependency
Strengthen switch regexes