consolidate JSON handling around JSON::MaybeXS, to provide a sane backend everywhere

this PR replaces and closes #1191.