convert ruby regexp objects to JSON regexp