Fixed invalid json being generated.