Avoiding the incorrect JSON with regexp