String f_json_encode(CVarRef value, bool loose /* = false */) { VariableSerializer vs(VariableSerializer::JSON, loose ? 1 : 0); String ret = vs.serialize(value, true); if (value.isContagious()) { value.clearContagious(); } return ret; }