void UserInfoResponse::writeJSON(PFStringJsonWriter& writer) { writer.StartObject(); if (PlayFabId.length() > 0) { writer.String("PlayFabId"); writer.String(PlayFabId.c_str()); } if (Username.length() > 0) { writer.String("Username"); writer.String(Username.c_str()); } if (TitleDisplayName.length() > 0) { writer.String("TitleDisplayName"); writer.String(TitleDisplayName.c_str()); } if (!Inventory.empty()) { writer.String("Inventory"); writer.StartArray(); for (std::list<ItemInstance>::iterator iter = Inventory.begin(); iter != Inventory.end(); iter++) { iter->writeJSON(writer); } writer.EndArray(); } if (!VirtualCurrency.empty()) { writer.String("VirtualCurrency"); writer.StartObject(); for (std::map<std::string, Int32>::iterator iter = VirtualCurrency.begin(); iter != VirtualCurrency.end(); ++iter) { writer.String(iter->first.c_str()); writer.Int(iter->second); } writer.EndObject(); } if (!VirtualCurrencyRechargeTimes.empty()) { writer.String("VirtualCurrencyRechargeTimes"); writer.StartObject(); for (std::map<std::string, VirtualCurrencyRechargeTime>::iterator iter = VirtualCurrencyRechargeTimes.begin(); iter != VirtualCurrencyRechargeTimes.end(); ++iter) { writer.String(iter->first.c_str()); iter->second.writeJSON(writer); } writer.EndObject(); } writer.String("IsDeveloper"); writer.Bool(IsDeveloper); if (SteamId.length() > 0) { writer.String("SteamId"); writer.String(SteamId.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(); }