Fix to properly escape JSON with single quotes

This issue was introduced with the commit
e915bb3876e523c302f8c769c46a7b502b737a89