common: Fix JSON skipping when string ends after escape

Fixes #754