output to JSON; notes towards fixing some regexes, and other issues.