bool JSONNumber::serialize(JSONWriter &writer){ if (_ivalue){ std::string v; string_AppendFormat(v, "%d", _ivalue); writer.writeValue(v); return true; } else if (_fvalue){ std::string v; string_AppendFormat(v, "%f", _fvalue); writer.writeValue(v); return true; } return false; }
bool JSONBool::serialize(JSONWriter &writer){ if (_value){ writer.writeValue(_value ? "true" : "false"); return true; } return false; }
bool JSONString::serialize(JSONWriter &writer){ if (_value.length() > 0){ std::string v; string_AppendFormat(v, "\"%s\"", Json_Escape(_value).c_str()); writer.writeValue(v); return true; } return false; }