void AuthUserRequest::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();

    writer.String("AuthorizationTicket");
    writer.String(AuthorizationTicket.c_str());

    writer.EndObject();
}
void UserInfoRequest::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();

    writer.String("PlayFabId");
    writer.String(PlayFabId.c_str());
    writer.String("MinCatalogVersion");
    writer.Int(MinCatalogVersion);

    writer.EndObject();
}
void PlayerLeftRequest::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();

    writer.String("LobbyId");
    writer.String(LobbyId.c_str());
    writer.String("PlayFabId");
    writer.String(PlayFabId.c_str());

    writer.EndObject();
}
void VirtualCurrencyRechargeTime::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();

    writer.String("SecondsToRecharge");
    writer.Int(SecondsToRecharge);
    writer.String("RechargeTime");
    writeDatetime(RechargeTime, writer);
    writer.String("RechargeMax");
    writer.Int(RechargeMax);

    writer.EndObject();
}
void AuthUserResponse::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();

    writer.String("Authorized");
    writer.Bool(Authorized);
    if (PlayFabId.length() > 0) {
        writer.String("PlayFabId");
        writer.String(PlayFabId.c_str());
    }

    writer.EndObject();
}
void StartGameResponse::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();

    if (GameID.length() > 0) {
        writer.String("GameID");
        writer.String(GameID.c_str());
    }
    if (ServerHostname.length() > 0) {
        writer.String("ServerHostname");
        writer.String(ServerHostname.c_str());
    }
    writer.String("ServerPort");
    writer.Uint(ServerPort);

    writer.EndObject();
}
void StartGameRequest::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();

    writer.String("Build");
    writer.String(Build.c_str());
    writer.String("Region");
    writeRegionEnumJSON(pfRegion, writer);
    writer.String("GameMode");
    writer.String(GameMode.c_str());
    if (CustomCommandLineData.length() > 0) {
        writer.String("CustomCommandLineData");
        writer.String(CustomCommandLineData.c_str());
    }
    writer.String("ExternalMatchmakerEventEndpoint");
    writer.String(ExternalMatchmakerEventEndpoint.c_str());

    writer.EndObject();
}
void ItemInstance::writeJSON(PFStringJsonWriter& writer)
{
    writer.StartObject();

    if (ItemId.length() > 0) {
        writer.String("ItemId");
        writer.String(ItemId.c_str());
    }
    if (ItemInstanceId.length() > 0) {
        writer.String("ItemInstanceId");
        writer.String(ItemInstanceId.c_str());
    }
    if (ItemClass.length() > 0) {
        writer.String("ItemClass");
        writer.String(ItemClass.c_str());
    }
    if (PurchaseDate.notNull()) {
        writer.String("PurchaseDate");
        writeDatetime(PurchaseDate, writer);
    }
    if (Expiration.notNull()) {
        writer.String("Expiration");
        writeDatetime(Expiration, writer);
    }
    if (RemainingUses.notNull()) {
        writer.String("RemainingUses");
        writer.Int(RemainingUses);
    }
    if (UsesIncrementedBy.notNull()) {
        writer.String("UsesIncrementedBy");
        writer.Int(UsesIncrementedBy);
    }
    if (Annotation.length() > 0) {
        writer.String("Annotation");
        writer.String(Annotation.c_str());
    }
    if (CatalogVersion.length() > 0) {
        writer.String("CatalogVersion");
        writer.String(CatalogVersion.c_str());
    }
    if (BundleParent.length() > 0) {
        writer.String("BundleParent");
        writer.String(BundleParent.c_str());
    }
    if (DisplayName.length() > 0) {
        writer.String("DisplayName");
        writer.String(DisplayName.c_str());
    }
    if (UnitCurrency.length() > 0) {
        writer.String("UnitCurrency");
        writer.String(UnitCurrency.c_str());
    }
    writer.String("UnitPrice");
    writer.Uint(UnitPrice);
    if (!BundleContents.empty()) {
        writer.String("BundleContents");
        writer.StartArray();
        for (std::list<std::string>::iterator iter = BundleContents.begin(); iter != BundleContents.end(); iter++) {
            writer.String(iter->c_str());
        }
        writer.EndArray();
    }
    if (!CustomData.empty()) {
        writer.String("CustomData");
        writer.StartObject();
        for (std::map<std::string, std::string>::iterator iter = CustomData.begin(); iter != CustomData.end(); ++iter) {
            writer.String(iter->first.c_str());
            writer.String(iter->second.c_str());
        }
        writer.EndObject();
    }

    writer.EndObject();
}