Fix parsing of ~ version constraint with unstable versions, fixes #1476
Expand {} into a new line before manipulating json, fixes #1481