From 280318a011a1aa7e1d376331db59aba8691f3464 Mon Sep 17 00:00:00 2001 From: Andrey Litvitski Date: Thu, 19 Dec 2024 23:19:13 +0300 Subject: [PATCH] Replace the deprecated use of new JsonParser with the use of its static methods --- .../facebook/ads/sdk/ALMAdAccountInfo.java | 8 +- .../ads/sdk/ALMEndAdvertiserInfo.java | 8 +- .../java/com/facebook/ads/sdk/ALMEvent.java | 8 +- .../com/facebook/ads/sdk/ALMGuidance.java | 8 +- .../facebook/ads/sdk/ALMGuidanceMetrics.java | 8 +- .../facebook/ads/sdk/AMOneshopSettings.java | 8 +- .../facebook/ads/sdk/ANBlockedBICategory.java | 8 +- .../java/com/facebook/ads/sdk/APIContext.java | 3 +- .../com/facebook/ads/sdk/APIException.java | 3 +- .../java/com/facebook/ads/sdk/APINode.java | 9 +- .../com/facebook/ads/sdk/APINodeList.java | 3 +- .../java/com/facebook/ads/sdk/AREffect.java | 8 +- src/main/java/com/facebook/ads/sdk/Ad.java | 8 +- .../java/com/facebook/ads/sdk/AdAccount.java | 11 +- .../sdk/AdAccountAAACompatibleAdObjects.java | 8 +- .../ads/sdk/AdAccountAAASimilarCampaigns.java | 8 +- .../ads/sdk/AdAccountASLSchedule.java | 8 +- .../ads/sdk/AdAccountAdLimitsInsights.java | 8 +- .../ads/sdk/AdAccountAdRulesCountByType.java | 8 +- .../ads/sdk/AdAccountAdRulesHistory.java | 8 +- .../facebook/ads/sdk/AdAccountAdVolume.java | 8 +- .../sdk/AdAccountAdsRecommendedAudios.java | 8 +- .../ads/sdk/AdAccountAllPaymentMethods.java | 8 +- .../sdk/AdAccountAppSetupRequirements.java | 8 +- .../ads/sdk/AdAccountBankInfoList.java | 8 +- .../sdk/AdAccountBillingDatePreference.java | 8 +- .../ads/sdk/AdAccountBusinessConstraints.java | 8 +- ...dAccountCampaignAttributionOptionInfo.java | 8 +- .../ads/sdk/AdAccountCreationRequest.java | 8 +- .../sdk/AdAccountCustomAudienceLimits.java | 8 +- .../ads/sdk/AdAccountDefaultDestination.java | 8 +- .../ads/sdk/AdAccountDefaultObjective.java | 8 +- .../ads/sdk/AdAccountDeliveryEstimate.java | 8 +- .../ads/sdk/AdAccountDsaRecommendations.java | 8 +- .../AdAccountIosFourteenCampaignLimits.java | 8 +- .../ads/sdk/AdAccountLiveVideoAdvertiser.java | 8 +- ...ountMatchedSearchApplicationsEdgeData.java | 8 +- .../com/facebook/ads/sdk/AdAccountMaxBid.java | 8 +- ...ountOptimizationGoalsAEMv2Eligibility.java | 8 +- .../ads/sdk/AdAccountPaymentDetails.java | 8 +- .../ads/sdk/AdAccountPaymentOptions.java | 8 +- .../ads/sdk/AdAccountPrepayDetails.java | 8 +- .../ads/sdk/AdAccountPromotableObjects.java | 8 +- .../sdk/AdAccountPromotionProgressBar.java | 8 +- .../ads/sdk/AdAccountReachEstimate.java | 8 +- .../ads/sdk/AdAccountRecommendations.java | 8 +- .../AdAccountRecommendedCamapaignBudget.java | 8 +- .../ads/sdk/AdAccountRelatedIcoStudy.java | 8 +- .../ads/sdk/AdAccountSmartSuggestedAds.java | 8 +- .../facebook/ads/sdk/AdAccountSpendLimit.java | 8 +- .../ads/sdk/AdAccountSubscribedApps.java | 8 +- .../sdk/AdAccountSubsidyAmountDetails.java | 8 +- .../ads/sdk/AdAccountSuggestedTag.java | 8 +- .../ads/sdk/AdAccountTargetingUnified.java | 8 +- .../ads/sdk/AdAccountTrackingData.java | 8 +- .../sdk/AdAccountURLForAssetExtraction.java | 8 +- .../com/facebook/ads/sdk/AdAccountUser.java | 8 +- .../ads/sdk/AdAccountUserPermissions.java | 8 +- .../ads/sdk/AdAccountUserSettings.java | 8 +- .../ads/sdk/AdAccountYouthAdsAdvertiser.java | 8 +- .../java/com/facebook/ads/sdk/AdActivity.java | 8 +- .../com/facebook/ads/sdk/AdAssetBody.java | 8 +- .../ads/sdk/AdAssetCallToActionType.java | 8 +- ...setCustomizationRuleCustomizationSpec.java | 8 +- .../facebook/ads/sdk/AdAssetDescription.java | 8 +- .../ads/sdk/AdAssetFeedAdditionalData.java | 8 +- ...setFeedAdditionalDataPageNudgeMessage.java | 8 +- .../com/facebook/ads/sdk/AdAssetFeedSpec.java | 8 +- ...AdAssetFeedSpecAssetCustomizationRule.java | 8 +- .../ads/sdk/AdAssetFeedSpecAssetLabel.java | 8 +- .../facebook/ads/sdk/AdAssetFeedSpecBody.java | 8 +- .../ads/sdk/AdAssetFeedSpecCallToAction.java | 8 +- .../ads/sdk/AdAssetFeedSpecCaption.java | 8 +- .../ads/sdk/AdAssetFeedSpecCarousel.java | 8 +- ...dAssetFeedSpecCarouselChildAttachment.java | 8 +- .../ads/sdk/AdAssetFeedSpecDescription.java | 8 +- .../ads/sdk/AdAssetFeedSpecEvents.java | 8 +- .../ads/sdk/AdAssetFeedSpecGroupRule.java | 8 +- .../ads/sdk/AdAssetFeedSpecImage.java | 8 +- .../ads/sdk/AdAssetFeedSpecLinkURL.java | 8 +- .../ads/sdk/AdAssetFeedSpecTitle.java | 8 +- .../ads/sdk/AdAssetFeedSpecVideo.java | 8 +- .../com/facebook/ads/sdk/AdAssetImage.java | 8 +- .../com/facebook/ads/sdk/AdAssetLinkURL.java | 8 +- .../ads/sdk/AdAssetMessageExtensions.java | 8 +- .../ads/sdk/AdAssetOnsiteDestinations.java | 8 +- .../ads/sdk/AdAssetTargetRuleTargeting.java | 8 +- .../com/facebook/ads/sdk/AdAssetTitle.java | 8 +- .../com/facebook/ads/sdk/AdAssetVideo.java | 8 +- .../com/facebook/ads/sdk/AdAsyncRequest.java | 8 +- .../facebook/ads/sdk/AdAsyncRequestSet.java | 8 +- .../AdAsyncRequestSetNotificationResult.java | 8 +- .../facebook/ads/sdk/AdBidAdjustments.java | 8 +- .../ads/sdk/AdCampaignBidConstraint.java | 8 +- ...CampaignConversionValueExpressionSpec.java | 8 +- .../ads/sdk/AdCampaignDeliveryEstimate.java | 8 +- .../ads/sdk/AdCampaignDeliveryStats.java | 8 +- ...mpaignDeliveryStatsUnsupportedReasons.java | 8 +- .../sdk/AdCampaignFrequencyControlSpecs.java | 8 +- ...crementalConversionOptimizationConfig.java | 8 +- .../sdk/AdCampaignGroupMetricsMetadata.java | 8 +- .../ads/sdk/AdCampaignGroupStats.java | 8 +- .../ads/sdk/AdCampaignGroupStructureTree.java | 8 +- .../ads/sdk/AdCampaignIssuesInfo.java | 8 +- .../ads/sdk/AdCampaignLearningStageInfo.java | 8 +- .../ads/sdk/AdCampaignMetricsMetadata.java | 8 +- .../facebook/ads/sdk/AdCampaignMultiAds.java | 8 +- .../ads/sdk/AdCampaignOptimizationEvent.java | 8 +- .../ads/sdk/AdCampaignPacedBidInfo.java | 8 +- .../com/facebook/ads/sdk/AdCampaignStats.java | 8 +- .../com/facebook/ads/sdk/AdColumnSizes.java | 8 +- .../java/com/facebook/ads/sdk/AdContract.java | 8 +- .../facebook/ads/sdk/AdConversionValues.java | 8 +- .../com/facebook/ads/sdk/AdConversions.java | 8 +- .../ads/sdk/AdCreationPackageConfig.java | 8 +- .../java/com/facebook/ads/sdk/AdCreative.java | 8 +- .../ads/sdk/AdCreativeAdDisclaimer.java | 8 +- .../ads/sdk/AdCreativeAssetGroupsSpec.java | 8 +- .../ads/sdk/AdCreativeBrandedContentAds.java | 8 +- .../AdCreativeBrandedContentAdsPartners.java | 8 +- .../AdCreativeCollectionThumbnailInfo.java | 8 +- .../ads/sdk/AdCreativeContextualMultiAds.java | 8 +- .../sdk/AdCreativeDegreesOfFreedomSpec.java | 8 +- .../ads/sdk/AdCreativeDestinationSpec.java | 8 +- .../sdk/AdCreativeFacebookBrandedContent.java | 8 +- .../sdk/AdCreativeFeatureActionMetadata.java | 8 +- .../sdk/AdCreativeFeatureCustomizations.java | 8 +- .../ads/sdk/AdCreativeFeatureDetails.java | 8 +- .../ads/sdk/AdCreativeFeaturesSpec.java | 8 +- .../sdk/AdCreativeGenerativeAssetSpec.java | 8 +- .../AdCreativeHouseShopsAdsSellerContent.java | 8 +- .../sdk/AdCreativeImageDataMediaElements.java | 8 +- .../facebook/ads/sdk/AdCreativeInsights.java | 8 +- .../AdCreativeInstagramBrandedContent.java | 8 +- .../AdCreativeInteractiveComponentsSpec.java | 8 +- .../facebook/ads/sdk/AdCreativeLinkData.java | 8 +- .../sdk/AdCreativeLinkDataAppLinkSpec.java | 8 +- .../sdk/AdCreativeLinkDataCallToAction.java | 8 +- .../AdCreativeLinkDataCallToActionValue.java | 8 +- .../AdCreativeLinkDataChildAttachment.java | 8 +- .../AdCreativeLinkDataCustomOverlaySpec.java | 8 +- .../sdk/AdCreativeLinkDataImageLayerSpec.java | 8 +- .../AdCreativeLinkDataImageOverlaySpec.java | 8 +- .../ads/sdk/AdCreativeLinkDataMoment.java | 8 +- ...AdCreativeLinkDataSponsorshipInfoSpec.java | 8 +- .../AdCreativeLinkDataTemplateVideoSpec.java | 8 +- ...reativeMarketingMessageStructuredSpec.java | 8 +- .../ads/sdk/AdCreativeObjectStorySpec.java | 8 +- .../sdk/AdCreativeOmnichannelLinkSpec.java | 8 +- .../facebook/ads/sdk/AdCreativePhotoData.java | 8 +- .../sdk/AdCreativePhotoDataMediaElements.java | 8 +- .../facebook/ads/sdk/AdCreativePlaceData.java | 8 +- .../sdk/AdCreativePlatformCustomization.java | 8 +- .../sdk/AdCreativePortraitCustomizations.java | 8 +- .../sdk/AdCreativePostClickConfiguration.java | 8 +- .../ads/sdk/AdCreativeProductData.java | 8 +- .../sdk/AdCreativePromotionMetadataSpec.java | 8 +- .../sdk/AdCreativeRecommenderSettings.java | 8 +- ...dCreativeRegionalRegulationDisclaimer.java | 8 +- .../ads/sdk/AdCreativeRewardInfo.java | 8 +- .../facebook/ads/sdk/AdCreativeShopSpec.java | 8 +- .../ads/sdk/AdCreativeSiteLinksSpec.java | 8 +- .../ads/sdk/AdCreativeSourcingSpec.java | 8 +- .../ads/sdk/AdCreativeStaticFallbackSpec.java | 8 +- .../ads/sdk/AdCreativeTemplateURLSpec.java | 8 +- .../facebook/ads/sdk/AdCreativeTextData.java | 8 +- .../facebook/ads/sdk/AdCreativeVideoData.java | 8 +- .../AdCreativeVideoDataCustomOverlaySpec.java | 8 +- .../sdk/AdCreativeVideoDataMediaElements.java | 8 +- .../sdk/AdCreativeWhatsAppChannelSpec.java | 8 +- .../ads/sdk/AdCustomDerivedMetrics.java | 8 +- .../ads/sdk/AdCustomizationRuleSpec.java | 8 +- .../com/facebook/ads/sdk/AdDefaultValues.java | 8 +- .../java/com/facebook/ads/sdk/AdDraft.java | 8 +- .../facebook/ads/sdk/AdDynamicCreative.java | 8 +- .../facebook/ads/sdk/AdEntityTargetSpend.java | 8 +- .../com/facebook/ads/sdk/AdExportPreset.java | 8 +- .../java/com/facebook/ads/sdk/AdImage.java | 8 +- .../com/facebook/ads/sdk/AdKeywordStats.java | 8 +- .../java/com/facebook/ads/sdk/AdKeywords.java | 8 +- .../java/com/facebook/ads/sdk/AdKpiShift.java | 8 +- .../java/com/facebook/ads/sdk/AdLabel.java | 8 +- .../com/facebook/ads/sdk/AdLightAdgroup.java | 8 +- .../com/facebook/ads/sdk/AdLightCampaign.java | 8 +- .../ads/sdk/AdLightCampaignGroup.java | 8 +- .../com/facebook/ads/sdk/AdLimitSetting.java | 8 +- .../ads/sdk/AdLimitsEnforcementData.java | 8 +- .../ads/sdk/AdMonetizationProperty.java | 8 +- .../AdNetworkAnalyticsAsyncQueryExport.java | 8 +- .../AdNetworkAnalyticsAsyncQueryResult.java | 8 +- .../AdNetworkAnalyticsSyncQueryResult.java | 8 +- .../com/facebook/ads/sdk/AdPlacePageSet.java | 8 +- .../ads/sdk/AdPlacePageSetMetadata.java | 8 +- .../com/facebook/ads/sdk/AdPlacement.java | 8 +- .../java/com/facebook/ads/sdk/AdPreview.java | 8 +- .../facebook/ads/sdk/AdPromotedObject.java | 8 +- .../java/com/facebook/ads/sdk/AdProposal.java | 8 +- .../facebook/ads/sdk/AdRecommendation.java | 8 +- .../ads/sdk/AdRecommendationData.java | 8 +- .../com/facebook/ads/sdk/AdReportRun.java | 11 +- .../java/com/facebook/ads/sdk/AdRule.java | 8 +- .../ads/sdk/AdRuleEvaluationSpec.java | 8 +- .../ads/sdk/AdRuleExecutionOptions.java | 8 +- .../facebook/ads/sdk/AdRuleExecutionSpec.java | 8 +- .../com/facebook/ads/sdk/AdRuleFilters.java | 8 +- .../com/facebook/ads/sdk/AdRuleHistory.java | 8 +- .../facebook/ads/sdk/AdRuleHistoryResult.java | 8 +- .../ads/sdk/AdRuleHistoryResultAction.java | 8 +- .../com/facebook/ads/sdk/AdRuleSchedule.java | 8 +- .../facebook/ads/sdk/AdRuleScheduleSpec.java | 8 +- .../com/facebook/ads/sdk/AdRuleTrigger.java | 8 +- .../com/facebook/ads/sdk/AdSavedKeywords.java | 8 +- .../com/facebook/ads/sdk/AdSavedLocation.java | 8 +- .../com/facebook/ads/sdk/AdSavedReport.java | 8 +- src/main/java/com/facebook/ads/sdk/AdSet.java | 8 +- .../java/com/facebook/ads/sdk/AdStudy.java | 8 +- .../com/facebook/ads/sdk/AdStudyCell.java | 8 +- .../facebook/ads/sdk/AdStudyObjective.java | 8 +- .../facebook/ads/sdk/AdStudyObjectiveID.java | 8 +- .../sdk/AdStudyObjectiveOffsiteDatasets.java | 8 +- .../java/com/facebook/ads/sdk/AdTopline.java | 8 +- .../com/facebook/ads/sdk/AdToplineDetail.java | 8 +- .../java/com/facebook/ads/sdk/AdVideo.java | 8 +- .../java/com/facebook/ads/sdk/AdVolume.java | 8 +- .../ads/sdk/AdgroupFacebookFeedback.java | 8 +- .../facebook/ads/sdk/AdgroupIssuesInfo.java | 8 +- .../com/facebook/ads/sdk/AdgroupMetadata.java | 8 +- ...dgroupPlacementSpecificReviewFeedback.java | 8 +- .../ads/sdk/AdgroupReviewFeedback.java | 8 +- .../sdk/AdjacentContentDeliveryReport.java | 8 +- .../com/facebook/ads/sdk/AdsActionStats.java | 8 +- .../facebook/ads/sdk/AdsAnomalyDetection.java | 8 +- .../facebook/ads/sdk/AdsConversionGoal.java | 8 +- .../ads/sdk/AdsCreationSavedState.java | 8 +- .../ads/sdk/AdsCustomPivotsPreview.java | 8 +- .../com/facebook/ads/sdk/AdsDataPartner.java | 8 +- .../java/com/facebook/ads/sdk/AdsDataset.java | 8 +- .../ads/sdk/AdsGuidanceQEExposure.java | 8 +- .../facebook/ads/sdk/AdsHistogramStats.java | 8 +- .../com/facebook/ads/sdk/AdsImageCrops.java | 8 +- .../com/facebook/ads/sdk/AdsInsights.java | 8 +- .../facebook/ads/sdk/AdsNamingTemplate.java | 8 +- .../AdsOptimalDeliveryGrowthOpportunity.java | 8 +- .../com/facebook/ads/sdk/AdsPaymentCycle.java | 8 +- .../com/facebook/ads/sdk/AdsPivotRules.java | 8 +- .../java/com/facebook/ads/sdk/AdsPixel.java | 8 +- .../ads/sdk/AdsPixelCAPISetupQuality.java | 8 +- .../ads/sdk/AdsPixelCapabilityOverride.java | 8 +- .../sdk/AdsPixelDeliveryRecommendations.java | 8 +- .../ads/sdk/AdsPixelDomainControlRule.java | 8 +- .../ads/sdk/AdsPixelDomainLastFiredTime.java | 8 +- .../ads/sdk/AdsPixelEventLastFiredTime.java | 8 +- .../ads/sdk/AdsPixelEventPrediction.java | 8 +- .../ads/sdk/AdsPixelEventSuggestionRule.java | 8 +- .../facebook/ads/sdk/AdsPixelItemPrice.java | 8 +- .../ads/sdk/AdsPixelMicrodataStats.java | 8 +- .../ads/sdk/AdsPixelRawFiresResult.java | 8 +- .../sdk/AdsPixelRealTimeEventLogResult.java | 8 +- .../ads/sdk/AdsPixelRecentEventsResult.java | 8 +- .../sdk/AdsPixelSignalsIWLFeedbackNux.java | 8 +- .../ads/sdk/AdsPixelSignalsIWLNux.java | 8 +- .../com/facebook/ads/sdk/AdsPixelStats.java | 8 +- .../facebook/ads/sdk/AdsPixelStatsResult.java | 8 +- .../com/facebook/ads/sdk/AdsQuickViews.java | 8 +- .../facebook/ads/sdk/AdsReportBuilder.java | 8 +- .../ads/sdk/AdsReportBuilderExportCore.java | 8 +- .../ads/sdk/AdsReportBuilderMMMReport.java | 8 +- .../AdsReportBuilderMMMReportScheduler.java | 8 +- .../ads/sdk/AdsReportBuilderSavedReport.java | 8 +- .../com/facebook/ads/sdk/AdsSegments.java | 8 +- .../ads/sdk/AdsSignalDiagnosticIssue.java | 8 +- .../ads/sdk/AdsStartYourDayWidget.java | 8 +- .../java/com/facebook/ads/sdk/AdsTabular.java | 8 +- .../ads/sdk/AdsTargetingInsights.java | 8 +- .../facebook/ads/sdk/AdsTextSuggestions.java | 8 +- .../com/facebook/ads/sdk/AdsUserSettings.java | 8 +- .../ads/sdk/AdsValueAdjustmentRule.java | 8 +- .../sdk/AdsValueAdjustmentRuleCollection.java | 8 +- .../com/facebook/ads/sdk/AdvAInstance.java | 8 +- .../ads/sdk/AdvertiserVerificationStatus.java | 8 +- .../java/com/facebook/ads/sdk/AgeRange.java | 8 +- .../ads/sdk/AgencyClientDeclaration.java | 8 +- src/main/java/com/facebook/ads/sdk/Album.java | 8 +- .../ads/sdk/AnalyticsCohortQueryResult.java | 272 ------------------ .../com/facebook/ads/sdk/AnalyticsConfig.java | 8 +- .../ads/sdk/AnalyticsEntityUserConfig.java | 8 +- .../ads/sdk/AnalyticsFunnelQueryResult.java | 8 +- .../sdk/AnalyticsPlatformMetricsConfig.java | 8 +- .../ads/sdk/AnalyticsQueryResult.java | 8 +- .../facebook/ads/sdk/AnalyticsSegment.java | 8 +- .../facebook/ads/sdk/AnalyticsUserConfig.java | 8 +- .../com/facebook/ads/sdk/AndroidAppLink.java | 8 +- .../com/facebook/ads/sdk/AppEventConfig.java | 8 +- .../java/com/facebook/ads/sdk/AppLinks.java | 8 +- .../ads/sdk/AppOptimizedCustomEvents.java | 8 +- .../com/facebook/ads/sdk/AppPublisher.java | 8 +- .../java/com/facebook/ads/sdk/AppRequest.java | 8 +- .../ads/sdk/AppRequestFormerRecipient.java | 8 +- .../com/facebook/ads/sdk/Application.java | 8 +- .../facebook/ads/sdk/ArAdsDataContainer.java | 8 +- .../com/facebook/ads/sdk/AssignedUser.java | 8 +- .../com/facebook/ads/sdk/AsyncRequest.java | 8 +- .../com/facebook/ads/sdk/AsyncSession.java | 8 +- .../com/facebook/ads/sdk/AttributionSpec.java | 8 +- .../com/facebook/ads/sdk/AudienceFunnel.java | 8 +- .../com/facebook/ads/sdk/AudienceOverlap.java | 8 +- .../facebook/ads/sdk/AudiencePermission.java | 8 +- .../ads/sdk/AudiencePermissionForActions.java | 8 +- .../ads/sdk/AudienceSharingAccountValid.java | 8 +- .../sdk/AudienceSharingRecipientAccounts.java | 8 +- .../java/com/facebook/ads/sdk/AudioAsset.java | 8 +- .../com/facebook/ads/sdk/AudioCopyright.java | 8 +- .../java/com/facebook/ads/sdk/AudioIsrc.java | 8 +- .../com/facebook/ads/sdk/AudioRelease.java | 8 +- .../ads/sdk/AudioVisualReferenceMatch.java | 8 +- .../java/com/facebook/ads/sdk/AuthLink.java | 8 +- .../com/facebook/ads/sdk/AutomotiveModel.java | 8 +- .../java/com/facebook/ads/sdk/Avatar.java | 8 +- .../ads/sdk/AvatarProfilePicture.java | 8 +- .../java/com/facebook/ads/sdk/BAPIDomain.java | 8 +- .../com/facebook/ads/sdk/BCPCampaign.java | 8 +- .../ads/sdk/BespokePartnerGuidanceLaser.java | 8 +- .../com/facebook/ads/sdk/BidSchedule.java | 8 +- .../ads/sdk/BizInboxOffsiteEmailAccount.java | 8 +- .../java/com/facebook/ads/sdk/BlindPig.java | 8 +- .../com/facebook/ads/sdk/BlockedUserInfo.java | 8 +- .../com/facebook/ads/sdk/BrandRequest.java | 8 +- .../ads/sdk/BrandSafetyBlockListUsage.java | 8 +- .../ads/sdk/BrandSafetyCampaignConfig.java | 8 +- .../ads/sdk/BrandSafetyDownloadable.java | 8 +- .../ads/sdk/BrandedContentAdError.java | 8 +- .../sdk/BrandedContentEligibleSponsorIDs.java | 8 +- .../sdk/BrandedContentShadowIGMediaID.java | 8 +- .../ads/sdk/BrandedContentShadowIGUserID.java | 8 +- .../ads/sdk/BroadTargetingCategories.java | 8 +- .../java/com/facebook/ads/sdk/Business.java | 8 +- .../ads/sdk/BusinessAdAccountRequest.java | 8 +- .../sdk/BusinessAdsReportingReportSpecs.java | 8 +- ...usinessAdvertisableApplicationsResult.java | 8 +- .../facebook/ads/sdk/BusinessAgreement.java | 8 +- .../ads/sdk/BusinessApplicationRequest.java | 8 +- .../facebook/ads/sdk/BusinessAssetGroup.java | 8 +- .../sdk/BusinessAssetSharingAgreement.java | 8 +- .../facebook/ads/sdk/BusinessCreative.java | 8 +- .../ads/sdk/BusinessCreativeFolder.java | 8 +- .../ads/sdk/BusinessCreativeInsights.java | 8 +- .../ads/sdk/BusinessFranchiseConfig.java | 8 +- .../com/facebook/ads/sdk/BusinessImage.java | 8 +- .../BusinessImageTBusinessFolderPathItem.java | 8 +- .../BusinessManagedPartnerEligibility.java | 8 +- ...inessMediaAdPlacementValidationResult.java | 8 +- .../com/facebook/ads/sdk/BusinessObject.java | 8 +- ...inessObjectTransferOwnershipAgreement.java | 8 +- .../BusinessOwnedObjectOnBehalfOfRequest.java | 8 +- .../facebook/ads/sdk/BusinessPageRequest.java | 8 +- .../sdk/BusinessPartnerPremiumOptions.java | 8 +- .../ads/sdk/BusinessProductCatalogTOS.java | 8 +- .../com/facebook/ads/sdk/BusinessProject.java | 8 +- .../com/facebook/ads/sdk/BusinessRequest.java | 8 +- .../facebook/ads/sdk/BusinessRoleRequest.java | 8 +- .../ads/sdk/BusinessSettingLogsData.java | 8 +- .../com/facebook/ads/sdk/BusinessTag.java | 8 +- .../sdk/BusinessTrafficAnalysisReport.java | 8 +- .../com/facebook/ads/sdk/BusinessUser.java | 8 +- .../com/facebook/ads/sdk/BusinessVideo.java | 8 +- .../BusinessVideoTBusinessFolderPathItem.java | 8 +- .../sdk/CASSSetupOfflineEventSetProgress.java | 8 +- .../ads/sdk/CPASAdCreationTemplate.java | 8 +- ...ASAdvertiserPartnershipRecommendation.java | 8 +- .../ads/sdk/CPASBusinessSetupConfig.java | 8 +- .../ads/sdk/CPASCollaborationRequest.java | 8 +- .../facebook/ads/sdk/CPASLsbImageBank.java | 8 +- .../facebook/ads/sdk/CPASMerchantConfig.java | 8 +- .../ads/sdk/CPASParentCatalogSettings.java | 8 +- .../java/com/facebook/ads/sdk/CPASSetup.java | 8 +- .../sdk/CPASSetupPageStructureProgress.java | 8 +- .../java/com/facebook/ads/sdk/CRMAddress.java | 8 +- .../ads/sdk/CTWAWhatsAppNumbersInfo.java | 8 +- .../ads/sdk/CTXOptimizationEligibility.java | 8 +- .../sdk/CTXPartnerAppWelcomeMessageFlow.java | 8 +- .../ads/sdk/CalibratorExistingRule.java | 8 +- .../facebook/ads/sdk/CallAdsPhoneData.java | 8 +- .../java/com/facebook/ads/sdk/Campaign.java | 8 +- .../facebook/ads/sdk/CampaignActionsData.java | 8 +- .../sdk/CampaignGroupBrandConfiguration.java | 8 +- ...paignGroupCollaborativeAdsPartnerInfo.java | 8 +- .../java/com/facebook/ads/sdk/Canvas.java | 8 +- .../facebook/ads/sdk/CanvasAdSettings.java | 8 +- .../facebook/ads/sdk/CanvasBodyElement.java | 8 +- .../ads/sdk/CanvasCollectionThumbnail.java | 8 +- .../ads/sdk/CanvasDynamicSetting.java | 8 +- .../com/facebook/ads/sdk/CanvasPreview.java | 8 +- .../com/facebook/ads/sdk/CanvasTemplate.java | 8 +- .../ads/sdk/CatalogBasedTargeting.java | 8 +- .../facebook/ads/sdk/CatalogItemAppLinks.java | 8 +- .../CatalogItemChannelsToIntegrityStatus.java | 8 +- .../facebook/ads/sdk/CatalogItemOverride.java | 8 +- .../ads/sdk/CatalogItemRejectionReasons.java | 8 +- .../sdk/CatalogItemValidationErrorList.java | 8 +- .../ads/sdk/CatalogSmartPixelSettings.java | 8 +- .../ads/sdk/CatalogSubVerticalList.java | 8 +- .../sdk/CatalogWebsiteOnboardingSettings.java | 8 +- .../ads/sdk/CatalogWebsiteSettings.java | 8 +- .../java/com/facebook/ads/sdk/ChatPlugin.java | 8 +- .../ads/sdk/CheckBatchRequestStatus.java | 8 +- .../java/com/facebook/ads/sdk/ChildEvent.java | 8 +- ...ChinaBusinessOnboardingVettingRequest.java | 9 +- .../java/com/facebook/ads/sdk/CloudGame.java | 8 +- .../ads/sdk/CloudbridgeDatasetStatus.java | 8 +- .../CollaborativeAdsPartnerBusinesses.java | 8 +- .../CollaborativeAdsPartnerInfoListItem.java | 8 +- .../sdk/CollaborativeAdsShareSettings.java | 8 +- .../facebook/ads/sdk/ColumnSuggestions.java | 8 +- .../java/com/facebook/ads/sdk/Comment.java | 8 +- .../ads/sdk/CommerceMerchantSettings.java | 8 +- .../CommerceMerchantSettingsSetupStatus.java | 8 +- .../com/facebook/ads/sdk/CommerceOrder.java | 8 +- .../sdk/CommerceOrderTransactionDetail.java | 8 +- .../com/facebook/ads/sdk/CommercePayout.java | 8 +- .../facebook/ads/sdk/CommerceSettings.java | 8 +- .../ads/sdk/ConnectionsTargeting.java | 8 +- .../ads/sdk/ContactsMessengerSyncConfig.java | 8 +- .../facebook/ads/sdk/ContentBlockList.java | 8 +- .../ads/sdk/ContentDeliveryReport.java | 8 +- .../sdk/ContentPublishingLimitResponse.java | 8 +- .../ads/sdk/ContextualBundlingSpec.java | 8 +- .../ads/sdk/ConversionActionQuery.java | 8 +- .../facebook/ads/sdk/ConversionHealthKPI.java | 8 +- .../ads/sdk/CopyrightAttributionInsights.java | 8 +- .../facebook/ads/sdk/CopyrightAudioAsset.java | 8 +- .../ads/sdk/CopyrightMediaMisuse.java | 8 +- .../ads/sdk/CopyrightReferenceContainer.java | 8 +- .../java/com/facebook/ads/sdk/CoverPhoto.java | 8 +- .../facebook/ads/sdk/CreativeAssetTag.java | 8 +- .../com/facebook/ads/sdk/CreativeHistory.java | 8 +- .../ads/sdk/CreatorAssetCreative.java | 8 +- .../java/com/facebook/ads/sdk/CreditCard.java | 8 +- .../ads/sdk/CreditPartitionActionOptions.java | 8 +- .../java/com/facebook/ads/sdk/Currency.java | 8 +- .../com/facebook/ads/sdk/CurrencyAmount.java | 8 +- .../com/facebook/ads/sdk/CustomAudience.java | 8 +- .../ads/sdk/CustomAudienceAdAccount.java | 8 +- .../ads/sdk/CustomAudienceCapabilities.java | 8 +- .../ads/sdk/CustomAudienceDataSource.java | 8 +- .../facebook/ads/sdk/CustomAudienceGroup.java | 8 +- .../facebook/ads/sdk/CustomAudienceSalts.java | 8 +- .../ads/sdk/CustomAudienceSession.java | 8 +- ...stomAudienceSharedAccountCampaignInfo.java | 8 +- .../ads/sdk/CustomAudienceSharingStatus.java | 8 +- .../ads/sdk/CustomAudienceStatus.java | 8 +- .../facebook/ads/sdk/CustomAudiencesTOS.java | 8 +- .../sdk/CustomAudiencesharedAccountInfo.java | 8 +- .../facebook/ads/sdk/CustomConversion.java | 8 +- .../ads/sdk/CustomConversionActivities.java | 8 +- .../ads/sdk/CustomConversionStatsResult.java | 8 +- .../facebook/ads/sdk/CustomUserSettings.java | 8 +- .../java/com/facebook/ads/sdk/DACheck.java | 8 +- .../java/com/facebook/ads/sdk/Dataset.java | 8 +- .../java/com/facebook/ads/sdk/DayPart.java | 8 +- .../com/facebook/ads/sdk/DeliveryCheck.java | 8 +- .../ads/sdk/DeliveryCheckExtraInfo.java | 8 +- .../com/facebook/ads/sdk/DeliveryInfo.java | 8 +- .../com/facebook/ads/sdk/DeliveryStatus.java | 8 +- .../com/facebook/ads/sdk/DeliveryWindow.java | 8 +- .../com/facebook/ads/sdk/Destination.java | 8 +- .../com/facebook/ads/sdk/DirectDebit.java | 8 +- .../java/com/facebook/ads/sdk/Domain.java | 8 +- .../java/com/facebook/ads/sdk/DraftPost.java | 8 +- .../facebook/ads/sdk/DynamicARMetadata.java | 8 +- .../facebook/ads/sdk/DynamicContentSet.java | 8 +- .../ads/sdk/DynamicItemDisplayBundle.java | 8 +- .../sdk/DynamicItemDisplayBundleFolder.java | 8 +- .../ads/sdk/DynamicPostChildAttachment.java | 8 +- .../ads/sdk/DynamicPriceConfigByDate.java | 8 +- .../ads/sdk/DynamicVideoMetadata.java | 8 +- .../facebook/ads/sdk/EducationExperience.java | 8 +- .../com/facebook/ads/sdk/EmailImport.java | 8 +- .../facebook/ads/sdk/EndStudyCriteria.java | 8 +- .../java/com/facebook/ads/sdk/Engagement.java | 8 +- .../com/facebook/ads/sdk/EntWithSponsor.java | 8 +- .../facebook/ads/sdk/EntityAtTextRange.java | 8 +- src/main/java/com/facebook/ads/sdk/Event.java | 8 +- .../ads/sdk/EventExternalTicketInfo.java | 8 +- .../ads/sdk/EventRegistrationSetting.java | 8 +- .../facebook/ads/sdk/EventSourceGroup.java | 8 +- .../facebook/ads/sdk/EventTicketSetting.java | 8 +- .../com/facebook/ads/sdk/EventTicketTier.java | 8 +- .../java/com/facebook/ads/sdk/EventTour.java | 8 +- .../java/com/facebook/ads/sdk/Experience.java | 8 +- .../com/facebook/ads/sdk/ExtendedCredit.java | 8 +- .../sdk/ExtendedCreditAllocationConfig.java | 8 +- .../ads/sdk/ExtendedCreditApplication.java | 8 +- .../facebook/ads/sdk/ExtendedCreditEmail.java | 8 +- .../facebook/ads/sdk/ExtendedCreditInfo.java | 8 +- .../ads/sdk/ExtendedCreditInvoiceGroup.java | 8 +- .../facebook/ads/sdk/ExternalEventSource.java | 8 +- ...xternalEventSourceCPASEventsDebugging.java | 8 +- ...nalEventSourceCPASEventsDebuggingInfo.java | 8 +- .../ads/sdk/ExternalMerchantSettings.java | 8 +- .../java/com/facebook/ads/sdk/FAMEKumo.java | 8 +- .../ads/sdk/FBImageCopyrightMatch.java | 8 +- .../ads/sdk/FBLiteToNTTransitions.java | 8 +- .../ads/sdk/FBPageAndInstagramAccount.java | 8 +- .../facebook/ads/sdk/FBPayButtonLogin.java | 8 +- .../com/facebook/ads/sdk/FantasyGame.java | 8 +- .../com/facebook/ads/sdk/FavoriteCatalog.java | 8 +- .../com/facebook/ads/sdk/FinanceObject.java | 8 +- .../facebook/ads/sdk/FlexibleTargeting.java | 8 +- .../java/com/facebook/ads/sdk/Flight.java | 8 +- .../facebook/ads/sdk/FranchiseProgram.java | 8 +- .../ads/sdk/FranchiseProgramMember.java | 8 +- .../ads/sdk/FundingSourceDetails.java | 8 +- .../ads/sdk/FundingSourceDetailsCoupon.java | 8 +- .../ads/sdk/FundraiserPersonToCharity.java | 8 +- .../com/facebook/ads/sdk/GeoGatingPolicy.java | 8 +- src/main/java/com/facebook/ads/sdk/Group.java | 8 +- .../com/facebook/ads/sdk/HasLeadAccess.java | 8 +- .../facebook/ads/sdk/HighDemandPeriod.java | 8 +- ...mandPeriodTimeSuggestionWeeklySegment.java | 8 +- .../com/facebook/ads/sdk/HomeListing.java | 8 +- src/main/java/com/facebook/ads/sdk/Hotel.java | 8 +- .../java/com/facebook/ads/sdk/HotelRoom.java | 8 +- src/main/java/com/facebook/ads/sdk/Hours.java | 8 +- .../java/com/facebook/ads/sdk/IDName.java | 8 +- .../ads/sdk/IGAccessTokenForIGOnlyAPI.java | 8 +- .../facebook/ads/sdk/IGBCAdsPermission.java | 8 +- .../com/facebook/ads/sdk/IGBoostMediaAd.java | 8 +- .../java/com/facebook/ads/sdk/IGComment.java | 8 +- .../facebook/ads/sdk/IGCommentFromUser.java | 8 +- .../java/com/facebook/ads/sdk/IGMedia.java | 8 +- .../ads/sdk/IGMediaBoostEligibilityInfo.java | 8 +- .../facebook/ads/sdk/IGMediaForIGOnlyAPI.java | 8 +- .../IGProductTaggingInvalidationError.java | 8 +- .../sdk/IGRefreshAccessTokenForIGOnlyAPI.java | 8 +- .../ads/sdk/IGResumableVideoUploadStatus.java | 8 +- .../ads/sdk/IGShoppingProductAppeal.java | 8 +- .../ads/sdk/IGShoppingReviewStatus.java | 8 +- ...ShoppingReviewStatusOnsiteEligibility.java | 8 +- ...pingReviewStatusReasonWithHelpMessage.java | 8 +- .../com/facebook/ads/sdk/IGUpcomingEvent.java | 8 +- .../java/com/facebook/ads/sdk/IGUser.java | 8 +- .../facebook/ads/sdk/IGUserExportForCAM.java | 8 +- .../facebook/ads/sdk/IGUserForIGOnlyAPI.java | 8 +- ...VideoCopyrightCheckMatchesInformation.java | 8 +- .../ads/sdk/IGVideoCopyrightCheckStatus.java | 8 +- .../java/com/facebook/ads/sdk/IPObject.java | 8 +- .../com/facebook/ads/sdk/ImageCopyright.java | 8 +- .../ads/sdk/ImageCopyrightDispute.java | 8 +- .../facebook/ads/sdk/ImageReferenceMatch.java | 8 +- .../com/facebook/ads/sdk/InsightsResult.java | 8 +- .../com/facebook/ads/sdk/InsightsValue.java | 8 +- ...InstagramBoostableMediaForAccessToken.java | 8 +- .../facebook/ads/sdk/InstagramCarousel.java | 8 +- .../facebook/ads/sdk/InstagramComment.java | 8 +- .../ads/sdk/InstagramInsightsResult.java | 8 +- .../ads/sdk/InstagramInsightsValue.java | 8 +- .../com/facebook/ads/sdk/InstagramMedia.java | 8 +- .../ads/sdk/InstagramRelatedProductTags.java | 8 +- ...nstagramShoppingMerchantReviewMessage.java | 8 +- .../com/facebook/ads/sdk/InstagramUser.java | 8 +- .../ads/sdk/InstagramVideoMetadata.java | 8 +- .../InstantArticleInsightsQueryResult.java | 8 +- .../java/com/facebook/ads/sdk/IosAppLink.java | 8 +- .../java/com/facebook/ads/sdk/JobOpening.java | 8 +- .../java/com/facebook/ads/sdk/KeyValue.java | 8 +- .../ads/sdk/KeywordDeliveryReport.java | 8 +- src/main/java/com/facebook/ads/sdk/Lead.java | 8 +- .../sdk/LeadGenAppointmentBookingInfo.java | 8 +- .../ads/sdk/LeadGenAppointmentSlotsByDay.java | 8 +- .../ads/sdk/LeadGenAppointmentTimeSlot.java | 8 +- ...adGenConditionalQuestionsGroupChoices.java | 8 +- ...GenConditionalQuestionsGroupQuestions.java | 8 +- .../facebook/ads/sdk/LeadGenContextCard.java | 8 +- .../ads/sdk/LeadGenCustomDisclaimer.java | 8 +- .../ads/sdk/LeadGenCustomDisclaimerBody.java | 8 +- .../facebook/ads/sdk/LeadGenDataDraft.java | 8 +- .../LeadGenDirectCRMIntegrationConfig.java | 8 +- .../ads/sdk/LeadGenDraftQuestion.java | 8 +- .../ads/sdk/LeadGenFormPreviewDetails.java | 8 +- .../facebook/ads/sdk/LeadGenLegalContent.java | 8 +- .../ads/sdk/LeadGenLegalContentCheckbox.java | 8 +- .../sdk/LeadGenPostSubmissionCheckResult.java | 8 +- .../ads/sdk/LeadGenPrivacyPolicy.java | 8 +- .../com/facebook/ads/sdk/LeadGenQuestion.java | 8 +- .../ads/sdk/LeadGenQuestionOption.java | 8 +- .../facebook/ads/sdk/LeadGenThankYouPage.java | 8 +- .../ads/sdk/LeadGenThankYouPageGatedFile.java | 8 +- .../sdk/LeadGenThankYouPageGatedPromo.java | 8 +- .../ads/sdk/LeadGenURLEntityAtRanges.java | 8 +- .../com/facebook/ads/sdk/LeadgenForm.java | 8 +- .../java/com/facebook/ads/sdk/LifeEvent.java | 8 +- src/main/java/com/facebook/ads/sdk/Link.java | 8 +- .../ads/sdk/LinkedInstagramAccountData.java | 8 +- .../java/com/facebook/ads/sdk/LiveVideo.java | 8 +- .../ads/sdk/LiveVideoAdBreakConfig.java | 8 +- .../com/facebook/ads/sdk/LiveVideoError.java | 8 +- .../ads/sdk/LiveVideoInputStream.java | 8 +- .../LiveVideoRecommendedEncoderSettings.java | 8 +- .../facebook/ads/sdk/LiveVideoTargeting.java | 8 +- .../ads/sdk/LocalServiceBusiness.java | 8 +- .../java/com/facebook/ads/sdk/Location.java | 8 +- .../com/facebook/ads/sdk/LookalikeSpec.java | 8 +- .../java/com/facebook/ads/sdk/LoomConfig.java | 8 +- .../ads/sdk/MCExperienceConfigForApi.java | 8 +- .../facebook/ads/sdk/MIXInsightsResult.java | 8 +- .../com/facebook/ads/sdk/MailingAddress.java | 8 +- .../ads/sdk/ManagedPartnerBusiness.java | 8 +- .../ads/sdk/ManagedPartnerExtendedCredit.java | 8 +- .../ads/sdk/MarketingMessageTargeting.java | 8 +- .../ads/sdk/McomInvoiceBankAccount.java | 8 +- .../facebook/ads/sdk/McomInvoiceDetails.java | 8 +- .../facebook/ads/sdk/McomInvoiceLists.java | 8 +- .../facebook/ads/sdk/McomInvoiceStatus.java | 8 +- .../ads/sdk/McomOnboardingStatus.java | 8 +- .../com/facebook/ads/sdk/McomPayouts.java | 8 +- .../facebook/ads/sdk/MeasurementReport.java | 8 +- .../ads/sdk/MediaCopyrightAttribution.java | 8 +- .../ads/sdk/MediaCopyrightUpdateRecord.java | 8 +- .../facebook/ads/sdk/MediaFingerprint.java | 8 +- .../java/com/facebook/ads/sdk/MediaTitle.java | 8 +- .../facebook/ads/sdk/MerchantCompliance.java | 8 +- .../com/facebook/ads/sdk/MerchantReport.java | 8 +- .../ads/sdk/MessageDeliveryEstimate.java | 8 +- .../facebook/ads/sdk/MessagingAppsInfo.java | 8 +- .../ads/sdk/MessagingFeatureReview.java | 8 +- .../ads/sdk/MessagingFeatureStatus.java | 8 +- .../MessengerAdsPartialAutomatedStepList.java | 8 +- .../ads/sdk/MessengerBusinessTemplate.java | 8 +- .../ads/sdk/MessengerCallSettings.java | 8 +- ...essengerDestinationPageWelcomeMessage.java | 8 +- .../facebook/ads/sdk/MessengerProfile.java | 8 +- .../com/facebook/ads/sdk/MinimumBudget.java | 8 +- .../facebook/ads/sdk/MusicVideoCopyright.java | 8 +- .../facebook/ads/sdk/MusicWorkCopyright.java | 8 +- .../facebook/ads/sdk/NegativeKeywordList.java | 8 +- .../java/com/facebook/ads/sdk/NullNode.java | 8 +- .../ads/sdk/OfflineConversionDataSet.java | 8 +- .../OfflineConversionDataSetActivities.java | 8 +- ...neConversionDataSetOptimizationStatus.java | 8 +- .../OfflineConversionDataSetPermissions.java | 8 +- .../sdk/OfflineConversionDataSetUpload.java | 8 +- .../sdk/OfflineConversionDataSetUsage.java | 8 +- .../facebook/ads/sdk/OfflineProductItem.java | 8 +- .../ads/sdk/OfflineTermsOfService.java | 8 +- .../com/facebook/ads/sdk/OffsitePixel.java | 8 +- .../OffsiteSignalContainerBusinessObject.java | 8 +- .../facebook/ads/sdk/OmegaCustomerTrx.java | 8 +- .../ads/sdk/OpenBridgeConfiguration.java | 8 +- .../facebook/ads/sdk/OpenGraphContext.java | 8 +- .../facebook/ads/sdk/OrderIDAttributions.java | 8 +- .../com/facebook/ads/sdk/Organization.java | 8 +- .../ads/sdk/OutcomePredictionPoint.java | 8 +- .../com/facebook/ads/sdk/OverrideDetails.java | 8 +- .../com/facebook/ads/sdk/OwnedDomain.java | 8 +- .../facebook/ads/sdk/P2MInvoicePayments.java | 8 +- src/main/java/com/facebook/ads/sdk/Page.java | 8 +- .../ads/sdk/PageAboutStoryComposedBlock.java | 8 +- ...geAboutStoryComposedBlockEntityRanges.java | 8 +- ...ageAboutStoryComposedBlockInlineStyle.java | 8 +- .../ads/sdk/PageAppWithLeadsAccess.java | 8 +- .../com/facebook/ads/sdk/PageBroadcast.java | 8 +- .../com/facebook/ads/sdk/PageCTSTopic.java | 8 +- ...SimilarAdvertiserBudgetRecommendation.java | 8 +- .../ads/sdk/PageCTXDefaultGreetingText.java | 8 +- .../ads/sdk/PageCTXMessagingFeatureLimit.java | 8 +- .../facebook/ads/sdk/PageCallToAction.java | 8 +- .../com/facebook/ads/sdk/PageCategory.java | 8 +- .../facebook/ads/sdk/PageChangeProposal.java | 8 +- .../ads/sdk/PageCrmsWithLeadsAccess.java | 8 +- ...geDirectIntegrationCrmWithLeadsAccess.java | 8 +- .../ads/sdk/PageGameBotQuotaInformation.java | 8 +- .../ads/sdk/PageGetStartedNullstate.java | 8 +- .../ads/sdk/PageInsightsAsyncExportRun.java | 8 +- .../ads/sdk/PageLeadsAccessConfig.java | 8 +- .../ads/sdk/PageLocationsBreakdown.java | 8 +- .../sdk/PageMessageResponsivenessMetrics.java | 8 +- .../com/facebook/ads/sdk/PageParking.java | 8 +- .../ads/sdk/PagePartnerWithLeadsAccess.java | 8 +- .../facebook/ads/sdk/PagePaymentOptions.java | 8 +- .../java/com/facebook/ads/sdk/PagePost.java | 8 +- .../facebook/ads/sdk/PagePostExperiment.java | 8 +- .../com/facebook/ads/sdk/PagePublisher.java | 8 +- .../ads/sdk/PageRestaurantServices.java | 8 +- .../ads/sdk/PageRestaurantSpecialties.java | 8 +- .../com/facebook/ads/sdk/PageSettings.java | 8 +- .../com/facebook/ads/sdk/PageStartInfo.java | 8 +- .../com/facebook/ads/sdk/PageThreadOwner.java | 8 +- .../facebook/ads/sdk/PageUpcomingChange.java | 8 +- .../ads/sdk/PageUserMessageThreadLabel.java | 8 +- .../facebook/ads/sdk/PageUserPermissions.java | 8 +- .../ads/sdk/PageUserWithLeadsAccess.java | 8 +- .../facebook/ads/sdk/ParentCatalogReport.java | 8 +- .../ads/sdk/PartnerAccountLinking.java | 8 +- .../com/facebook/ads/sdk/PartnerCategory.java | 8 +- .../ads/sdk/PartnerIntegrationLinked.java | 8 +- .../com/facebook/ads/sdk/PartnerStudy.java | 8 +- .../sdk/PartnershipAdContentSearchMedia.java | 8 +- .../ads/sdk/PartnershipAdsIdentity.java | 8 +- .../ads/sdk/PaymentEnginePayment.java | 8 +- .../facebook/ads/sdk/PaymentPricepoints.java | 8 +- .../ads/sdk/PaymentRequestDetails.java | 8 +- .../facebook/ads/sdk/PaymentSubscription.java | 8 +- .../java/com/facebook/ads/sdk/Permission.java | 8 +- .../java/com/facebook/ads/sdk/Persona.java | 8 +- .../facebook/ads/sdk/PersonalAdsPersona.java | 8 +- src/main/java/com/facebook/ads/sdk/Photo.java | 8 +- .../com/facebook/ads/sdk/PhotoMetadata.java | 8 +- src/main/java/com/facebook/ads/sdk/Place.java | 8 +- .../java/com/facebook/ads/sdk/PlaceTag.java | 8 +- .../java/com/facebook/ads/sdk/PlaceTopic.java | 8 +- .../java/com/facebook/ads/sdk/Placement.java | 8 +- .../facebook/ads/sdk/PlatformImageSource.java | 8 +- .../facebook/ads/sdk/PlatformSessionKey.java | 8 +- .../com/facebook/ads/sdk/PlayableContent.java | 8 +- src/main/java/com/facebook/ads/sdk/Post.java | 8 +- .../facebook/ads/sdk/PreapprovalReview.java | 8 +- .../facebook/ads/sdk/PremiumMusicVideo.java | 8 +- .../java/com/facebook/ads/sdk/Privacy.java | 8 +- .../com/facebook/ads/sdk/PrivacyOption.java | 8 +- .../sdk/PrivateComputationEnvironment.java | 8 +- .../ads/sdk/PrivateLiftStudyInstance.java | 8 +- .../com/facebook/ads/sdk/ProductCatalog.java | 8 +- .../ads/sdk/ProductCatalogCategory.java | 8 +- .../ads/sdk/ProductCatalogDataSource.java | 8 +- .../sdk/ProductCatalogDiagnosticGroup.java | 8 +- .../ads/sdk/ProductCatalogFacets.java | 8 +- .../sdk/ProductCatalogHotelRoomsBatch.java | 8 +- .../ads/sdk/ProductCatalogImageSettings.java | 8 +- .../ProductCatalogImageSettingsInternal.java | 8 +- .../ProductCatalogImageSettingsOperation.java | 8 +- .../ProductCatalogLocalizationSettings.java | 8 +- .../ProductCatalogPricingVariablesBatch.java | 8 +- .../sdk/ProductCatalogProductSetsBatch.java | 8 +- .../ads/sdk/ProductCatalogUserActions.java | 8 +- .../sdk/ProductCatalogUserPermissions.java | 8 +- .../ads/sdk/ProductCatalogUserTasks.java | 8 +- .../ads/sdk/ProductDaEventSamplesBatch.java | 8 +- .../ads/sdk/ProductDeliveryPreference.java | 8 +- .../facebook/ads/sdk/ProductEventStat.java | 8 +- .../com/facebook/ads/sdk/ProductFeed.java | 8 +- .../com/facebook/ads/sdk/ProductFeedRule.java | 8 +- .../ads/sdk/ProductFeedRulePreviewSample.java | 8 +- .../ads/sdk/ProductFeedRuleSuggestion.java | 8 +- .../facebook/ads/sdk/ProductFeedSchedule.java | 8 +- .../facebook/ads/sdk/ProductFeedUpload.java | 8 +- .../ads/sdk/ProductFeedUploadError.java | 8 +- .../ads/sdk/ProductFeedUploadErrorReport.java | 8 +- .../ads/sdk/ProductFeedUploadErrorSample.java | 8 +- .../ads/sdk/ProductFeedUploadProgress.java | 8 +- .../com/facebook/ads/sdk/ProductGroup.java | 8 +- .../com/facebook/ads/sdk/ProductImage.java | 8 +- .../com/facebook/ads/sdk/ProductItem.java | 8 +- .../ads/sdk/ProductItemCommerceInsights.java | 8 +- .../facebook/ads/sdk/ProductItemError.java | 8 +- .../ads/sdk/ProductItemImporterAddress.java | 8 +- .../facebook/ads/sdk/ProductItemInsights.java | 8 +- .../ads/sdk/ProductItemInvalidationError.java | 8 +- .../ads/sdk/ProductItemLandingPageData.java | 8 +- .../ads/sdk/ProductItemLocalInfo.java | 8 +- .../sdk/ProductItemLocalInfoLatLongShape.java | 8 +- .../facebook/ads/sdk/ProductItemOffer.java | 8 +- .../facebook/ads/sdk/ProductItemShipping.java | 8 +- .../ads/sdk/ProductItemSubscriptionInfo.java | 8 +- .../ads/sdk/ProductItemUnitPrice.java | 8 +- .../java/com/facebook/ads/sdk/ProductSet.java | 8 +- .../facebook/ads/sdk/ProductSetMetadata.java | 8 +- .../ads/sdk/ProductSetTaxonCategory.java | 8 +- .../com/facebook/ads/sdk/ProductSetUsage.java | 8 +- .../com/facebook/ads/sdk/ProductVariant.java | 8 +- .../ads/sdk/ProductVisualVariant.java | 8 +- .../java/com/facebook/ads/sdk/Profile.java | 8 +- .../ads/sdk/ProfilePictureSource.java | 8 +- .../facebook/ads/sdk/PublisherBlockList.java | 8 +- .../ads/sdk/PublisherDeliveryReport.java | 8 +- .../facebook/ads/sdk/PublisherWhiteList.java | 8 +- .../com/facebook/ads/sdk/RTBDynamicPost.java | 8 +- .../facebook/ads/sdk/RawCustomAudience.java | 8 +- .../ads/sdk/ReachFrequencyActivity.java | 8 +- .../ads/sdk/ReachFrequencyAdFormat.java | 8 +- ...achFrequencyCurveLowerConfidenceRange.java | 8 +- ...achFrequencyCurveUpperConfidenceRange.java | 8 +- .../ads/sdk/ReachFrequencyDayPart.java | 8 +- .../ads/sdk/ReachFrequencyEstimatesCurve.java | 8 +- ...hFrequencyEstimatesPlacementBreakdown.java | 8 +- .../ads/sdk/ReachFrequencyPrediction.java | 8 +- .../facebook/ads/sdk/ReachFrequencySpec.java | 8 +- .../com/facebook/ads/sdk/Recommendation.java | 8 +- .../facebook/ads/sdk/RecommendedIGMedia.java | 8 +- .../facebook/ads/sdk/RecommendedPagePost.java | 8 +- .../ads/sdk/RegionalRegulationIdentities.java | 8 +- .../facebook/ads/sdk/ReportingAudience.java | 8 +- .../facebook/ads/sdk/ResearchPollStudy.java | 8 +- .../facebook/ads/sdk/ResellerGuidance.java | 8 +- .../com/facebook/ads/sdk/RevSharePolicy.java | 8 +- .../facebook/ads/sdk/RichMediaElement.java | 8 +- .../ads/sdk/RightsManagerDataExport.java | 8 +- .../ads/sdk/RightsManagerInsights.java | 8 +- src/main/java/com/facebook/ads/sdk/Robot.java | 8 +- .../sdk/SalesRightsInventoryManagement.java | 8 +- .../com/facebook/ads/sdk/SavedAudience.java | 8 +- .../ads/sdk/SavedMessageResponse.java | 8 +- .../com/facebook/ads/sdk/ScheduledPost.java | 8 +- .../ads/sdk/ScimCompanyUserPhoneNumber.java | 8 +- .../facebook/ads/sdk/SecuritySettings.java | 8 +- .../com/facebook/ads/sdk/ShadowIGHashtag.java | 8 +- .../ShadowIGMediaBoostedInsightsResult.java | 8 +- .../ads/sdk/ShadowIGMediaBuilder.java | 8 +- .../ads/sdk/ShadowIGMediaCollaborators.java | 8 +- .../ads/sdk/ShadowIGMediaProductTags.java | 8 +- .../sdk/ShadowIGUserCatalogProductSearch.java | 8 +- .../ShadowIGUserCatalogProductVariant.java | 8 +- ...ShadowIGUserPartnershipAdsMediaErrors.java | 8 +- src/main/java/com/facebook/ads/sdk/Shop.java | 8 +- .../facebook/ads/sdk/SignalsIWLExtractor.java | 8 +- .../ads/sdk/SingleOwnerAdditionalProfile.java | 8 +- .../java/com/facebook/ads/sdk/SiteLink.java | 8 +- .../ads/sdk/SlicedEventSourceGroup.java | 8 +- .../facebook/ads/sdk/SmartPixelInsights.java | 8 +- .../com/facebook/ads/sdk/SocialWifiSite.java | 8 +- .../com/facebook/ads/sdk/SplitTestConfig.java | 8 +- .../com/facebook/ads/sdk/SplitTestWinner.java | 8 +- .../java/com/facebook/ads/sdk/Status.java | 8 +- .../ads/sdk/StoreCatalogSettings.java | 8 +- .../java/com/facebook/ads/sdk/Stories.java | 8 +- .../com/facebook/ads/sdk/StreamFilter.java | 8 +- .../java/com/facebook/ads/sdk/SystemUser.java | 8 +- src/main/java/com/facebook/ads/sdk/Tab.java | 8 +- .../com/facebook/ads/sdk/TaggableSubject.java | 8 +- .../java/com/facebook/ads/sdk/Targeting.java | 8 +- .../facebook/ads/sdk/TargetingAutomation.java | 8 +- .../ads/sdk/TargetingDynamicRule.java | 8 +- .../ads/sdk/TargetingGeoLocation.java | 8 +- .../ads/sdk/TargetingGeoLocationCity.java | 8 +- .../TargetingGeoLocationCustomLocation.java | 8 +- ...TargetingGeoLocationElectoralDistrict.java | 8 +- .../sdk/TargetingGeoLocationGeoEntities.java | 8 +- .../TargetingGeoLocationLocationCluster.java | 8 +- ...TargetingGeoLocationLocationExpansion.java | 8 +- .../ads/sdk/TargetingGeoLocationMarket.java | 8 +- .../ads/sdk/TargetingGeoLocationPlace.java | 8 +- ...TargetingGeoLocationPoliticalDistrict.java | 8 +- .../ads/sdk/TargetingGeoLocationRegion.java | 8 +- .../ads/sdk/TargetingGeoLocationZip.java | 8 +- .../TargetingMarketingMessageChannels.java | 8 +- .../ads/sdk/TargetingProductAudienceSpec.java | 8 +- .../sdk/TargetingProductAudienceSubSpec.java | 8 +- .../ads/sdk/TargetingProspectingAudience.java | 8 +- .../facebook/ads/sdk/TargetingRelaxation.java | 8 +- .../ads/sdk/TargetingSentenceLine.java | 8 +- .../facebook/ads/sdk/TextWithEntities.java | 8 +- .../ThirdPartyMeasurementReportDataset.java | 8 +- .../ads/sdk/ThirdPartyPartnerLiftRequest.java | 8 +- .../sdk/ThirdPartyPartnerPanelRequest.java | 8 +- .../sdk/ThirdPartyPartnerPanelScheduled.java | 8 +- .../ThirdPartyPartnerViewabilityRequest.java | 8 +- .../com/facebook/ads/sdk/TimeSuggestion.java | 8 +- .../com/facebook/ads/sdk/TimezoneOffset.java | 8 +- .../TrackingAndConversionWithDefaults.java | 8 +- .../facebook/ads/sdk/TransactableItem.java | 8 +- .../com/facebook/ads/sdk/Transaction.java | 8 +- src/main/java/com/facebook/ads/sdk/URL.java | 8 +- .../com/facebook/ads/sdk/UnifiedThread.java | 8 +- .../facebook/ads/sdk/UniqueAdCreative.java | 8 +- src/main/java/com/facebook/ads/sdk/User.java | 8 +- .../ads/sdk/UserAvailableCatalogs.java | 8 +- .../com/facebook/ads/sdk/UserContext.java | 8 +- .../com/facebook/ads/sdk/UserCoverPhoto.java | 8 +- .../java/com/facebook/ads/sdk/UserDevice.java | 8 +- .../com/facebook/ads/sdk/UserIDForApp.java | 8 +- .../com/facebook/ads/sdk/UserIDForPage.java | 8 +- .../sdk/UserLeadGenDisclaimerResponse.java | 8 +- .../ads/sdk/UserLeadGenFieldData.java | 8 +- .../facebook/ads/sdk/UserMobileConfig.java | 8 +- .../sdk/UserNotificationSeenStateData.java | 8 +- .../UserPageOneTimeOptInTokenSettings.java | 8 +- .../ads/sdk/UserPaymentMethodsInfo.java | 8 +- .../ads/sdk/UserPaymentMobilePricepoints.java | 8 +- .../ads/sdk/UserPaymentModulesOptions.java | 8 +- .../ads/sdk/ValueBasedEligibleSource.java | 8 +- .../java/com/facebook/ads/sdk/Vehicle.java | 8 +- .../com/facebook/ads/sdk/VehicleOffer.java | 8 +- .../com/facebook/ads/sdk/VideoCopyright.java | 8 +- .../ads/sdk/VideoCopyrightCheckStatus.java | 8 +- .../ads/sdk/VideoCopyrightConditionGroup.java | 8 +- .../ads/sdk/VideoCopyrightGeoGate.java | 8 +- .../facebook/ads/sdk/VideoCopyrightMatch.java | 8 +- .../facebook/ads/sdk/VideoCopyrightRule.java | 8 +- .../ads/sdk/VideoCopyrightSegment.java | 8 +- .../java/com/facebook/ads/sdk/VideoGroup.java | 8 +- .../java/com/facebook/ads/sdk/VideoList.java | 8 +- .../facebook/ads/sdk/VideoMetricsReport.java | 8 +- .../java/com/facebook/ads/sdk/VideoPoll.java | 8 +- .../java/com/facebook/ads/sdk/VideoStats.java | 8 +- .../com/facebook/ads/sdk/VideoStatus.java | 8 +- .../facebook/ads/sdk/VideoStatusError.java | 8 +- .../ads/sdk/VideoStatusProcessingPhase.java | 8 +- .../ads/sdk/VideoStatusPublishingPhase.java | 8 +- .../ads/sdk/VideoStatusUploadingPhase.java | 8 +- .../facebook/ads/sdk/VideoTextQuestion.java | 8 +- .../com/facebook/ads/sdk/VideoThumbnail.java | 8 +- .../facebook/ads/sdk/VideoUploadLimits.java | 8 +- .../java/com/facebook/ads/sdk/VoipInfo.java | 8 +- .../java/com/facebook/ads/sdk/WITUser.java | 8 +- .../ads/sdk/WearableDevicePublicKey.java | 8 +- .../java/com/facebook/ads/sdk/WebAppLink.java | 8 +- .../com/facebook/ads/sdk/WebPublisher.java | 8 +- .../ads/sdk/WebsiteCreativeAssetSource.java | 8 +- .../sdk/WebsiteCreativeAssetSuggestions.java | 8 +- .../ads/sdk/WhatsAppBusinessAccount.java | 8 +- .../ads/sdk/WhatsAppBusinessHealthStatus.java | 8 +- ...AppBusinessHealthStatusForMessageSend.java | 8 +- ...ssPartnerClientVerificationSubmission.java | 8 +- ...hatsAppBusinessPreVerifiedPhoneNumber.java | 8 +- .../ads/sdk/WhatsAppBusinessProfile.java | 8 +- .../ads/sdk/WhatsAppPaymentCapabilities.java | 8 +- .../ads/sdk/WhatsappSubscribedAppsInfo.java | 8 +- .../com/facebook/ads/sdk/WhitehatFBDLRun.java | 8 +- .../com/facebook/ads/sdk/WifiInformation.java | 8 +- .../com/facebook/ads/sdk/WindowsAppLink.java | 8 +- .../facebook/ads/sdk/WindowsPhoneAppLink.java | 8 +- .../com/facebook/ads/sdk/WithAsset3D.java | 8 +- .../sdk/WoodhengePurchasedPAYGReceipt.java | 8 +- .../facebook/ads/sdk/WoodhengeSupporter.java | 8 +- .../com/facebook/ads/sdk/WorkAccessCode.java | 8 +- .../com/facebook/ads/sdk/WorkExperience.java | 8 +- .../java/com/facebook/ads/sdk/WorkSkill.java | 8 +- .../com/facebook/ads/sdk/WorkUserBadges.java | 8 +- .../facebook/ads/sdk/WorkUserFrontline.java | 8 +- 928 files changed, 2778 insertions(+), 4903 deletions(-) delete mode 100644 src/main/java/com/facebook/ads/sdk/AnalyticsCohortQueryResult.java diff --git a/src/main/java/com/facebook/ads/sdk/ALMAdAccountInfo.java b/src/main/java/com/facebook/ads/sdk/ALMAdAccountInfo.java index eb80c24e..91bd1a39 100644 --- a/src/main/java/com/facebook/ads/sdk/ALMAdAccountInfo.java +++ b/src/main/java/com/facebook/ads/sdk/ALMAdAccountInfo.java @@ -129,9 +129,8 @@ public String getId() { public static ALMAdAccountInfo loadJSON(String json, APIContext context, String header) { ALMAdAccountInfo almAdAccountInfo = getGson().fromJson(json, ALMAdAccountInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(almAdAccountInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(almAdAccountInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList almAdAccountInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ALMEndAdvertiserInfo.java b/src/main/java/com/facebook/ads/sdk/ALMEndAdvertiserInfo.java index 0aa0eaf9..6bd2b972 100644 --- a/src/main/java/com/facebook/ads/sdk/ALMEndAdvertiserInfo.java +++ b/src/main/java/com/facebook/ads/sdk/ALMEndAdvertiserInfo.java @@ -121,9 +121,8 @@ public String getId() { public static ALMEndAdvertiserInfo loadJSON(String json, APIContext context, String header) { ALMEndAdvertiserInfo almEndAdvertiserInfo = getGson().fromJson(json, ALMEndAdvertiserInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(almEndAdvertiserInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(almEndAdvertiserInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList almEndAdvertiserInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ALMEvent.java b/src/main/java/com/facebook/ads/sdk/ALMEvent.java index fd1fb341..3ae3506a 100644 --- a/src/main/java/com/facebook/ads/sdk/ALMEvent.java +++ b/src/main/java/com/facebook/ads/sdk/ALMEvent.java @@ -135,9 +135,8 @@ public String getId() { public static ALMEvent loadJSON(String json, APIContext context, String header) { ALMEvent almEvent = getGson().fromJson(json, ALMEvent.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(almEvent.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(almEvent.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -157,10 +156,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList almEvents = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ALMGuidance.java b/src/main/java/com/facebook/ads/sdk/ALMGuidance.java index a069daeb..5169b547 100644 --- a/src/main/java/com/facebook/ads/sdk/ALMGuidance.java +++ b/src/main/java/com/facebook/ads/sdk/ALMGuidance.java @@ -60,9 +60,8 @@ public String getId() { public static ALMGuidance loadJSON(String json, APIContext context, String header) { ALMGuidance almGuidance = getGson().fromJson(json, ALMGuidance.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(almGuidance.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(almGuidance.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList almGuidances = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ALMGuidanceMetrics.java b/src/main/java/com/facebook/ads/sdk/ALMGuidanceMetrics.java index 2a9cd4d9..7c6e2095 100644 --- a/src/main/java/com/facebook/ads/sdk/ALMGuidanceMetrics.java +++ b/src/main/java/com/facebook/ads/sdk/ALMGuidanceMetrics.java @@ -78,9 +78,8 @@ public String getId() { public static ALMGuidanceMetrics loadJSON(String json, APIContext context, String header) { ALMGuidanceMetrics almGuidanceMetrics = getGson().fromJson(json, ALMGuidanceMetrics.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(almGuidanceMetrics.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(almGuidanceMetrics.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -100,10 +99,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList almGuidanceMetricss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AMOneshopSettings.java b/src/main/java/com/facebook/ads/sdk/AMOneshopSettings.java index e09565eb..391b7daa 100644 --- a/src/main/java/com/facebook/ads/sdk/AMOneshopSettings.java +++ b/src/main/java/com/facebook/ads/sdk/AMOneshopSettings.java @@ -52,9 +52,8 @@ public String getId() { public static AMOneshopSettings loadJSON(String json, APIContext context, String header) { AMOneshopSettings amOneshopSettings = getGson().fromJson(json, AMOneshopSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(amOneshopSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(amOneshopSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList amOneshopSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ANBlockedBICategory.java b/src/main/java/com/facebook/ads/sdk/ANBlockedBICategory.java index 3e47116b..dd94dd40 100644 --- a/src/main/java/com/facebook/ads/sdk/ANBlockedBICategory.java +++ b/src/main/java/com/facebook/ads/sdk/ANBlockedBICategory.java @@ -54,9 +54,8 @@ public String getId() { public static ANBlockedBICategory loadJSON(String json, APIContext context, String header) { ANBlockedBICategory anBlockedBICategory = getGson().fromJson(json, ANBlockedBICategory.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(anBlockedBICategory.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(anBlockedBICategory.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList anBlockedBICategorys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/APIContext.java b/src/main/java/com/facebook/ads/sdk/APIContext.java index c0f34783..16fe0e34 100644 --- a/src/main/java/com/facebook/ads/sdk/APIContext.java +++ b/src/main/java/com/facebook/ads/sdk/APIContext.java @@ -160,8 +160,7 @@ public String getAppID() { params.put("fields", "app_id"); APIRequest.ResponseWrapper response = executor.execute("GET", apiUrl, params, this); - JsonParser parser = new JsonParser(); - this.appID = parser.parse(response.getBody()) + this.appID = JsonParser.parseString(response.getBody()) .getAsJsonObject() .get("data") .getAsJsonObject() diff --git a/src/main/java/com/facebook/ads/sdk/APIException.java b/src/main/java/com/facebook/ads/sdk/APIException.java index f7fe826c..9b467b94 100644 --- a/src/main/java/com/facebook/ads/sdk/APIException.java +++ b/src/main/java/com/facebook/ads/sdk/APIException.java @@ -68,8 +68,7 @@ public String getRawResponse() { @Override public JsonObject getRawResponseAsJsonObject() { - JsonParser parser = new JsonParser(); - return parser.parse(this.getMessage()).getAsJsonObject(); + return JsonParser.parseString(this.getMessage()).getAsJsonObject(); } @Override diff --git a/src/main/java/com/facebook/ads/sdk/APINode.java b/src/main/java/com/facebook/ads/sdk/APINode.java index 2d5961c5..3036a63d 100644 --- a/src/main/java/com/facebook/ads/sdk/APINode.java +++ b/src/main/java/com/facebook/ads/sdk/APINode.java @@ -63,8 +63,7 @@ public String toString() { public String getId() { try { - JsonParser parser = new JsonParser(); - return parser.parse(rawValue).getAsJsonObject().get("id").getAsString(); + return JsonParser.parseString(rawValue).getAsJsonObject().get("id").getAsString(); } catch (Exception e) { return null; } @@ -81,9 +80,8 @@ public String getRawResponse() { @Override public JsonObject getRawResponseAsJsonObject() { - JsonParser parser = new JsonParser(); try { - return parser.parse(rawValue).getAsJsonObject(); + return JsonParser.parseString(rawValue).getAsJsonObject(); } catch (Exception e) { return null; } @@ -103,10 +101,9 @@ public static APINodeList parseResponse(String json, APIContext context APINodeList nodes = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/APINodeList.java b/src/main/java/com/facebook/ads/sdk/APINodeList.java index 0ef02b41..e26652fd 100644 --- a/src/main/java/com/facebook/ads/sdk/APINodeList.java +++ b/src/main/java/com/facebook/ads/sdk/APINodeList.java @@ -128,8 +128,7 @@ public String getRawResponse() { @Override public JsonObject getRawResponseAsJsonObject() { - JsonParser parser = new JsonParser(); - return parser.parse(rawValue).getAsJsonObject(); + return JsonParser.parseString(rawValue).getAsJsonObject(); } @Override diff --git a/src/main/java/com/facebook/ads/sdk/AREffect.java b/src/main/java/com/facebook/ads/sdk/AREffect.java index f7744329..2007b36d 100644 --- a/src/main/java/com/facebook/ads/sdk/AREffect.java +++ b/src/main/java/com/facebook/ads/sdk/AREffect.java @@ -123,9 +123,8 @@ public String getId() { public static AREffect loadJSON(String json, APIContext context, String header) { AREffect arEffect = getGson().fromJson(json, AREffect.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(arEffect.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(arEffect.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList arEffects = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Ad.java b/src/main/java/com/facebook/ads/sdk/Ad.java index e453a7b7..cd63a34a 100644 --- a/src/main/java/com/facebook/ads/sdk/Ad.java +++ b/src/main/java/com/facebook/ads/sdk/Ad.java @@ -189,9 +189,8 @@ public String getId() { public static Ad loadJSON(String json, APIContext context, String header) { Ad ad = getGson().fromJson(json, Ad.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(ad.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(ad.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -211,10 +210,9 @@ public static APINodeList parseResponse(String json, APIContext context, API APINodeList ads = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccount.java b/src/main/java/com/facebook/ads/sdk/AdAccount.java index 3628bdf6..1045dfba 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccount.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccount.java @@ -254,9 +254,8 @@ public String getId() { public static AdAccount loadJSON(String json, APIContext context, String header) { AdAccount adAccount = getGson().fromJson(json, AdAccount.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccount.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccount.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -269,8 +268,7 @@ public static AdAccount loadJSON(String json, APIContext context, String header) adAccount.context = context; adAccount.rawValue = json; adAccount.header = header; - JsonParser parser = new JsonParser(); - JsonObject o = parser.parse(json).getAsJsonObject(); + JsonObject o = JsonParser.parseString(json).getAsJsonObject(); if (o.has("account_id")) { String accountId = o.get("account_id").getAsString(); if (accountId != null) { @@ -287,10 +285,9 @@ public static APINodeList parseResponse(String json, APIContext conte APINodeList adAccounts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountAAACompatibleAdObjects.java b/src/main/java/com/facebook/ads/sdk/AdAccountAAACompatibleAdObjects.java index fd7102da..5b6e9437 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountAAACompatibleAdObjects.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountAAACompatibleAdObjects.java @@ -58,9 +58,8 @@ public String getId() { public static AdAccountAAACompatibleAdObjects loadJSON(String json, APIContext context, String header) { AdAccountAAACompatibleAdObjects adAccountAAACompatibleAdObjects = getGson().fromJson(json, AdAccountAAACompatibleAdObjects.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountAAACompatibleAdObjects.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountAAACompatibleAdObjects.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String APINodeList adAccountAAACompatibleAdObjectss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountAAASimilarCampaigns.java b/src/main/java/com/facebook/ads/sdk/AdAccountAAASimilarCampaigns.java index c6a6b0ea..c885cb78 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountAAASimilarCampaigns.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountAAASimilarCampaigns.java @@ -58,9 +58,8 @@ public String getId() { public static AdAccountAAASimilarCampaigns loadJSON(String json, APIContext context, String header) { AdAccountAAASimilarCampaigns adAccountAAASimilarCampaigns = getGson().fromJson(json, AdAccountAAASimilarCampaigns.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountAAASimilarCampaigns.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountAAASimilarCampaigns.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String jso APINodeList adAccountAAASimilarCampaignss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountASLSchedule.java b/src/main/java/com/facebook/ads/sdk/AdAccountASLSchedule.java index 6ef56d0f..d5ea9908 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountASLSchedule.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountASLSchedule.java @@ -60,9 +60,8 @@ public String getId() { public static AdAccountASLSchedule loadJSON(String json, APIContext context, String header) { AdAccountASLSchedule adAccountASLSchedule = getGson().fromJson(json, AdAccountASLSchedule.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountASLSchedule.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountASLSchedule.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList adAccountASLSchedules = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountAdLimitsInsights.java b/src/main/java/com/facebook/ads/sdk/AdAccountAdLimitsInsights.java index 163932c3..3e4a46a2 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountAdLimitsInsights.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountAdLimitsInsights.java @@ -56,9 +56,8 @@ public String getId() { public static AdAccountAdLimitsInsights loadJSON(String json, APIContext context, String header) { AdAccountAdLimitsInsights adAccountAdLimitsInsights = getGson().fromJson(json, AdAccountAdLimitsInsights.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountAdLimitsInsights.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountAdLimitsInsights.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APINodeList adAccountAdLimitsInsightss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountAdRulesCountByType.java b/src/main/java/com/facebook/ads/sdk/AdAccountAdRulesCountByType.java index a366f5d2..efaf69e7 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountAdRulesCountByType.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountAdRulesCountByType.java @@ -56,9 +56,8 @@ public String getId() { public static AdAccountAdRulesCountByType loadJSON(String json, APIContext context, String header) { AdAccountAdRulesCountByType adAccountAdRulesCountByType = getGson().fromJson(json, AdAccountAdRulesCountByType.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountAdRulesCountByType.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountAdRulesCountByType.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json APINodeList adAccountAdRulesCountByTypes = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountAdRulesHistory.java b/src/main/java/com/facebook/ads/sdk/AdAccountAdRulesHistory.java index 96cbbc89..0754f362 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountAdRulesHistory.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountAdRulesHistory.java @@ -70,9 +70,8 @@ public String getId() { public static AdAccountAdRulesHistory loadJSON(String json, APIContext context, String header) { AdAccountAdRulesHistory adAccountAdRulesHistory = getGson().fromJson(json, AdAccountAdRulesHistory.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountAdRulesHistory.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountAdRulesHistory.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse(String json, AP APINodeList adAccountAdRulesHistorys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountAdVolume.java b/src/main/java/com/facebook/ads/sdk/AdAccountAdVolume.java index fe2a44b0..fb76bceb 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountAdVolume.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountAdVolume.java @@ -76,9 +76,8 @@ public String getId() { public static AdAccountAdVolume loadJSON(String json, APIContext context, String header) { AdAccountAdVolume adAccountAdVolume = getGson().fromJson(json, AdAccountAdVolume.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountAdVolume.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountAdVolume.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -98,10 +97,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList adAccountAdVolumes = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountAdsRecommendedAudios.java b/src/main/java/com/facebook/ads/sdk/AdAccountAdsRecommendedAudios.java index d59838dd..6f9c1ffa 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountAdsRecommendedAudios.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountAdsRecommendedAudios.java @@ -54,9 +54,8 @@ public String getId() { public static AdAccountAdsRecommendedAudios loadJSON(String json, APIContext context, String header) { AdAccountAdsRecommendedAudios adAccountAdsRecommendedAudios = getGson().fromJson(json, AdAccountAdsRecommendedAudios.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountAdsRecommendedAudios.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountAdsRecommendedAudios.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String js APINodeList adAccountAdsRecommendedAudioss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountAllPaymentMethods.java b/src/main/java/com/facebook/ads/sdk/AdAccountAllPaymentMethods.java index 1de4f1d0..fe4ff6ce 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountAllPaymentMethods.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountAllPaymentMethods.java @@ -52,9 +52,8 @@ public String getId() { public static AdAccountAllPaymentMethods loadJSON(String json, APIContext context, String header) { AdAccountAllPaymentMethods adAccountAllPaymentMethods = getGson().fromJson(json, AdAccountAllPaymentMethods.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountAllPaymentMethods.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountAllPaymentMethods.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseResponse(String json, APINodeList adAccountAllPaymentMethodss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountAppSetupRequirements.java b/src/main/java/com/facebook/ads/sdk/AdAccountAppSetupRequirements.java index 175f1b59..527552b7 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountAppSetupRequirements.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountAppSetupRequirements.java @@ -52,9 +52,8 @@ public String getId() { public static AdAccountAppSetupRequirements loadJSON(String json, APIContext context, String header) { AdAccountAppSetupRequirements adAccountAppSetupRequirements = getGson().fromJson(json, AdAccountAppSetupRequirements.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountAppSetupRequirements.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountAppSetupRequirements.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseResponse(String js APINodeList adAccountAppSetupRequirementss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountBankInfoList.java b/src/main/java/com/facebook/ads/sdk/AdAccountBankInfoList.java index 290f967c..c40cc692 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountBankInfoList.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountBankInfoList.java @@ -54,9 +54,8 @@ public String getId() { public static AdAccountBankInfoList loadJSON(String json, APIContext context, String header) { AdAccountBankInfoList adAccountBankInfoList = getGson().fromJson(json, AdAccountBankInfoList.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountBankInfoList.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountBankInfoList.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList adAccountBankInfoLists = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountBillingDatePreference.java b/src/main/java/com/facebook/ads/sdk/AdAccountBillingDatePreference.java index 6c08e9c6..ee43f79f 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountBillingDatePreference.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountBillingDatePreference.java @@ -64,9 +64,8 @@ public String getId() { public static AdAccountBillingDatePreference loadJSON(String json, APIContext context, String header) { AdAccountBillingDatePreference adAccountBillingDatePreference = getGson().fromJson(json, AdAccountBillingDatePreference.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountBillingDatePreference.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountBillingDatePreference.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String j APINodeList adAccountBillingDatePreferences = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountBusinessConstraints.java b/src/main/java/com/facebook/ads/sdk/AdAccountBusinessConstraints.java index 424357c4..ee9c6804 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountBusinessConstraints.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountBusinessConstraints.java @@ -60,9 +60,8 @@ public String getId() { public static AdAccountBusinessConstraints loadJSON(String json, APIContext context, String header) { AdAccountBusinessConstraints adAccountBusinessConstraints = getGson().fromJson(json, AdAccountBusinessConstraints.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountBusinessConstraints.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountBusinessConstraints.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String jso APINodeList adAccountBusinessConstraintss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountCampaignAttributionOptionInfo.java b/src/main/java/com/facebook/ads/sdk/AdAccountCampaignAttributionOptionInfo.java index 6efecc10..9cdd3c70 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountCampaignAttributionOptionInfo.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountCampaignAttributionOptionInfo.java @@ -56,9 +56,8 @@ public String getId() { public static AdAccountCampaignAttributionOptionInfo loadJSON(String json, APIContext context, String header) { AdAccountCampaignAttributionOptionInfo adAccountCampaignAttributionOptionInfo = getGson().fromJson(json, AdAccountCampaignAttributionOptionInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountCampaignAttributionOptionInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountCampaignAttributionOptionInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse( APINodeList adAccountCampaignAttributionOptionInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountCreationRequest.java b/src/main/java/com/facebook/ads/sdk/AdAccountCreationRequest.java index b6cfac8c..824b7977 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountCreationRequest.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountCreationRequest.java @@ -181,9 +181,8 @@ public String getId() { public static AdAccountCreationRequest loadJSON(String json, APIContext context, String header) { AdAccountCreationRequest adAccountCreationRequest = getGson().fromJson(json, AdAccountCreationRequest.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountCreationRequest.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountCreationRequest.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -203,10 +202,9 @@ public static APINodeList parseResponse(String json, A APINodeList adAccountCreationRequests = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountCustomAudienceLimits.java b/src/main/java/com/facebook/ads/sdk/AdAccountCustomAudienceLimits.java index 909b0589..5a94f99a 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountCustomAudienceLimits.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountCustomAudienceLimits.java @@ -62,9 +62,8 @@ public String getId() { public static AdAccountCustomAudienceLimits loadJSON(String json, APIContext context, String header) { AdAccountCustomAudienceLimits adAccountCustomAudienceLimits = getGson().fromJson(json, AdAccountCustomAudienceLimits.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountCustomAudienceLimits.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountCustomAudienceLimits.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String js APINodeList adAccountCustomAudienceLimitss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountDefaultDestination.java b/src/main/java/com/facebook/ads/sdk/AdAccountDefaultDestination.java index b3c4c407..72c59a78 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountDefaultDestination.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountDefaultDestination.java @@ -56,9 +56,8 @@ public String getId() { public static AdAccountDefaultDestination loadJSON(String json, APIContext context, String header) { AdAccountDefaultDestination adAccountDefaultDestination = getGson().fromJson(json, AdAccountDefaultDestination.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountDefaultDestination.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountDefaultDestination.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json APINodeList adAccountDefaultDestinations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountDefaultObjective.java b/src/main/java/com/facebook/ads/sdk/AdAccountDefaultObjective.java index cd28de45..a520dc4e 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountDefaultObjective.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountDefaultObjective.java @@ -56,9 +56,8 @@ public String getId() { public static AdAccountDefaultObjective loadJSON(String json, APIContext context, String header) { AdAccountDefaultObjective adAccountDefaultObjective = getGson().fromJson(json, AdAccountDefaultObjective.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountDefaultObjective.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountDefaultObjective.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APINodeList adAccountDefaultObjectives = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountDeliveryEstimate.java b/src/main/java/com/facebook/ads/sdk/AdAccountDeliveryEstimate.java index 2f457ed9..6333a590 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountDeliveryEstimate.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountDeliveryEstimate.java @@ -64,9 +64,8 @@ public String getId() { public static AdAccountDeliveryEstimate loadJSON(String json, APIContext context, String header) { AdAccountDeliveryEstimate adAccountDeliveryEstimate = getGson().fromJson(json, AdAccountDeliveryEstimate.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountDeliveryEstimate.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountDeliveryEstimate.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APINodeList adAccountDeliveryEstimates = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountDsaRecommendations.java b/src/main/java/com/facebook/ads/sdk/AdAccountDsaRecommendations.java index b082445e..92a7c762 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountDsaRecommendations.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountDsaRecommendations.java @@ -54,9 +54,8 @@ public String getId() { public static AdAccountDsaRecommendations loadJSON(String json, APIContext context, String header) { AdAccountDsaRecommendations adAccountDsaRecommendations = getGson().fromJson(json, AdAccountDsaRecommendations.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountDsaRecommendations.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountDsaRecommendations.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json APINodeList adAccountDsaRecommendationss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountIosFourteenCampaignLimits.java b/src/main/java/com/facebook/ads/sdk/AdAccountIosFourteenCampaignLimits.java index 8ea505b7..b611913f 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountIosFourteenCampaignLimits.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountIosFourteenCampaignLimits.java @@ -58,9 +58,8 @@ public String getId() { public static AdAccountIosFourteenCampaignLimits loadJSON(String json, APIContext context, String header) { AdAccountIosFourteenCampaignLimits adAccountIosFourteenCampaignLimits = getGson().fromJson(json, AdAccountIosFourteenCampaignLimits.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountIosFourteenCampaignLimits.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountIosFourteenCampaignLimits.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(Stri APINodeList adAccountIosFourteenCampaignLimitss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountLiveVideoAdvertiser.java b/src/main/java/com/facebook/ads/sdk/AdAccountLiveVideoAdvertiser.java index c06f7ec7..8278708e 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountLiveVideoAdvertiser.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountLiveVideoAdvertiser.java @@ -58,9 +58,8 @@ public String getId() { public static AdAccountLiveVideoAdvertiser loadJSON(String json, APIContext context, String header) { AdAccountLiveVideoAdvertiser adAccountLiveVideoAdvertiser = getGson().fromJson(json, AdAccountLiveVideoAdvertiser.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountLiveVideoAdvertiser.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountLiveVideoAdvertiser.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String jso APINodeList adAccountLiveVideoAdvertisers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountMatchedSearchApplicationsEdgeData.java b/src/main/java/com/facebook/ads/sdk/AdAccountMatchedSearchApplicationsEdgeData.java index a53e1711..1368bc95 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountMatchedSearchApplicationsEdgeData.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountMatchedSearchApplicationsEdgeData.java @@ -68,9 +68,8 @@ public String getId() { public static AdAccountMatchedSearchApplicationsEdgeData loadJSON(String json, APIContext context, String header) { AdAccountMatchedSearchApplicationsEdgeData adAccountMatchedSearchApplicationsEdgeData = getGson().fromJson(json, AdAccountMatchedSearchApplicationsEdgeData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountMatchedSearchApplicationsEdgeData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountMatchedSearchApplicationsEdgeData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseRespo APINodeList adAccountMatchedSearchApplicationsEdgeDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountMaxBid.java b/src/main/java/com/facebook/ads/sdk/AdAccountMaxBid.java index 1e9c4e77..fc246ac1 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountMaxBid.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountMaxBid.java @@ -54,9 +54,8 @@ public String getId() { public static AdAccountMaxBid loadJSON(String json, APIContext context, String header) { AdAccountMaxBid adAccountMaxBid = getGson().fromJson(json, AdAccountMaxBid.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountMaxBid.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountMaxBid.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adAccountMaxBids = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountOptimizationGoalsAEMv2Eligibility.java b/src/main/java/com/facebook/ads/sdk/AdAccountOptimizationGoalsAEMv2Eligibility.java index ae655928..150fe084 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountOptimizationGoalsAEMv2Eligibility.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountOptimizationGoalsAEMv2Eligibility.java @@ -56,9 +56,8 @@ public String getId() { public static AdAccountOptimizationGoalsAEMv2Eligibility loadJSON(String json, APIContext context, String header) { AdAccountOptimizationGoalsAEMv2Eligibility adAccountOptimizationGoalsAEMv2Eligibility = getGson().fromJson(json, AdAccountOptimizationGoalsAEMv2Eligibility.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountOptimizationGoalsAEMv2Eligibility.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountOptimizationGoalsAEMv2Eligibility.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseRespo APINodeList adAccountOptimizationGoalsAEMv2Eligibilitys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountPaymentDetails.java b/src/main/java/com/facebook/ads/sdk/AdAccountPaymentDetails.java index e8e11c2b..94d20706 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountPaymentDetails.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountPaymentDetails.java @@ -64,9 +64,8 @@ public String getId() { public static AdAccountPaymentDetails loadJSON(String json, APIContext context, String header) { AdAccountPaymentDetails adAccountPaymentDetails = getGson().fromJson(json, AdAccountPaymentDetails.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountPaymentDetails.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountPaymentDetails.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, AP APINodeList adAccountPaymentDetailss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountPaymentOptions.java b/src/main/java/com/facebook/ads/sdk/AdAccountPaymentOptions.java index 6e9e64c9..717c92e7 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountPaymentOptions.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountPaymentOptions.java @@ -60,9 +60,8 @@ public String getId() { public static AdAccountPaymentOptions loadJSON(String json, APIContext context, String header) { AdAccountPaymentOptions adAccountPaymentOptions = getGson().fromJson(json, AdAccountPaymentOptions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountPaymentOptions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountPaymentOptions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, AP APINodeList adAccountPaymentOptionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountPrepayDetails.java b/src/main/java/com/facebook/ads/sdk/AdAccountPrepayDetails.java index 4f1e32db..651787c4 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountPrepayDetails.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountPrepayDetails.java @@ -60,9 +60,8 @@ public String getId() { public static AdAccountPrepayDetails loadJSON(String json, APIContext context, String header) { AdAccountPrepayDetails adAccountPrepayDetails = getGson().fromJson(json, AdAccountPrepayDetails.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountPrepayDetails.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountPrepayDetails.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, API APINodeList adAccountPrepayDetailss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountPromotableObjects.java b/src/main/java/com/facebook/ads/sdk/AdAccountPromotableObjects.java index fdcc5abc..72c745a4 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountPromotableObjects.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountPromotableObjects.java @@ -58,9 +58,8 @@ public String getId() { public static AdAccountPromotableObjects loadJSON(String json, APIContext context, String header) { AdAccountPromotableObjects adAccountPromotableObjects = getGson().fromJson(json, AdAccountPromotableObjects.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountPromotableObjects.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountPromotableObjects.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APINodeList adAccountPromotableObjectss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountPromotionProgressBar.java b/src/main/java/com/facebook/ads/sdk/AdAccountPromotionProgressBar.java index b0f392e0..8d52ccdf 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountPromotionProgressBar.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountPromotionProgressBar.java @@ -68,9 +68,8 @@ public String getId() { public static AdAccountPromotionProgressBar loadJSON(String json, APIContext context, String header) { AdAccountPromotionProgressBar adAccountPromotionProgressBar = getGson().fromJson(json, AdAccountPromotionProgressBar.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountPromotionProgressBar.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountPromotionProgressBar.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String js APINodeList adAccountPromotionProgressBars = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountReachEstimate.java b/src/main/java/com/facebook/ads/sdk/AdAccountReachEstimate.java index a682abbb..80a6188e 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountReachEstimate.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountReachEstimate.java @@ -58,9 +58,8 @@ public String getId() { public static AdAccountReachEstimate loadJSON(String json, APIContext context, String header) { AdAccountReachEstimate adAccountReachEstimate = getGson().fromJson(json, AdAccountReachEstimate.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountReachEstimate.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountReachEstimate.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, API APINodeList adAccountReachEstimates = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountRecommendations.java b/src/main/java/com/facebook/ads/sdk/AdAccountRecommendations.java index c3a9b742..5b63a00a 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountRecommendations.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountRecommendations.java @@ -54,9 +54,8 @@ public String getId() { public static AdAccountRecommendations loadJSON(String json, APIContext context, String header) { AdAccountRecommendations adAccountRecommendations = getGson().fromJson(json, AdAccountRecommendations.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountRecommendations.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountRecommendations.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, A APINodeList adAccountRecommendationss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountRecommendedCamapaignBudget.java b/src/main/java/com/facebook/ads/sdk/AdAccountRecommendedCamapaignBudget.java index ffd535fa..46a124fc 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountRecommendedCamapaignBudget.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountRecommendedCamapaignBudget.java @@ -58,9 +58,8 @@ public String getId() { public static AdAccountRecommendedCamapaignBudget loadJSON(String json, APIContext context, String header) { AdAccountRecommendedCamapaignBudget adAccountRecommendedCamapaignBudget = getGson().fromJson(json, AdAccountRecommendedCamapaignBudget.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountRecommendedCamapaignBudget.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountRecommendedCamapaignBudget.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(Str APINodeList adAccountRecommendedCamapaignBudgets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountRelatedIcoStudy.java b/src/main/java/com/facebook/ads/sdk/AdAccountRelatedIcoStudy.java index 53aa8f08..9fb1f45c 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountRelatedIcoStudy.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountRelatedIcoStudy.java @@ -52,9 +52,8 @@ public String getId() { public static AdAccountRelatedIcoStudy loadJSON(String json, APIContext context, String header) { AdAccountRelatedIcoStudy adAccountRelatedIcoStudy = getGson().fromJson(json, AdAccountRelatedIcoStudy.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountRelatedIcoStudy.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountRelatedIcoStudy.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseResponse(String json, A APINodeList adAccountRelatedIcoStudys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountSmartSuggestedAds.java b/src/main/java/com/facebook/ads/sdk/AdAccountSmartSuggestedAds.java index 133d52fc..00f1efe3 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountSmartSuggestedAds.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountSmartSuggestedAds.java @@ -60,9 +60,8 @@ public String getId() { public static AdAccountSmartSuggestedAds loadJSON(String json, APIContext context, String header) { AdAccountSmartSuggestedAds adAccountSmartSuggestedAds = getGson().fromJson(json, AdAccountSmartSuggestedAds.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountSmartSuggestedAds.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountSmartSuggestedAds.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APINodeList adAccountSmartSuggestedAdss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountSpendLimit.java b/src/main/java/com/facebook/ads/sdk/AdAccountSpendLimit.java index dce4e800..7f97a56a 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountSpendLimit.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountSpendLimit.java @@ -66,9 +66,8 @@ public String getId() { public static AdAccountSpendLimit loadJSON(String json, APIContext context, String header) { AdAccountSpendLimit adAccountSpendLimit = getGson().fromJson(json, AdAccountSpendLimit.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountSpendLimit.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountSpendLimit.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList adAccountSpendLimits = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountSubscribedApps.java b/src/main/java/com/facebook/ads/sdk/AdAccountSubscribedApps.java index 140ee691..74d7c8d2 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountSubscribedApps.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountSubscribedApps.java @@ -56,9 +56,8 @@ public String getId() { public static AdAccountSubscribedApps loadJSON(String json, APIContext context, String header) { AdAccountSubscribedApps adAccountSubscribedApps = getGson().fromJson(json, AdAccountSubscribedApps.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountSubscribedApps.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountSubscribedApps.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, AP APINodeList adAccountSubscribedAppss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountSubsidyAmountDetails.java b/src/main/java/com/facebook/ads/sdk/AdAccountSubsidyAmountDetails.java index 6807893f..e68c682c 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountSubsidyAmountDetails.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountSubsidyAmountDetails.java @@ -58,9 +58,8 @@ public String getId() { public static AdAccountSubsidyAmountDetails loadJSON(String json, APIContext context, String header) { AdAccountSubsidyAmountDetails adAccountSubsidyAmountDetails = getGson().fromJson(json, AdAccountSubsidyAmountDetails.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountSubsidyAmountDetails.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountSubsidyAmountDetails.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String js APINodeList adAccountSubsidyAmountDetailss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountSuggestedTag.java b/src/main/java/com/facebook/ads/sdk/AdAccountSuggestedTag.java index 9590a960..e64aca5d 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountSuggestedTag.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountSuggestedTag.java @@ -58,9 +58,8 @@ public String getId() { public static AdAccountSuggestedTag loadJSON(String json, APIContext context, String header) { AdAccountSuggestedTag adAccountSuggestedTag = getGson().fromJson(json, AdAccountSuggestedTag.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountSuggestedTag.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountSuggestedTag.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList adAccountSuggestedTags = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountTargetingUnified.java b/src/main/java/com/facebook/ads/sdk/AdAccountTargetingUnified.java index 345d585a..1a64acea 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountTargetingUnified.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountTargetingUnified.java @@ -98,9 +98,8 @@ public String getId() { public static AdAccountTargetingUnified loadJSON(String json, APIContext context, String header) { AdAccountTargetingUnified adAccountTargetingUnified = getGson().fromJson(json, AdAccountTargetingUnified.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountTargetingUnified.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountTargetingUnified.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -120,10 +119,9 @@ public static APINodeList parseResponse(String json, APINodeList adAccountTargetingUnifieds = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountTrackingData.java b/src/main/java/com/facebook/ads/sdk/AdAccountTrackingData.java index f37bd706..aaa22931 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountTrackingData.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountTrackingData.java @@ -54,9 +54,8 @@ public String getId() { public static AdAccountTrackingData loadJSON(String json, APIContext context, String header) { AdAccountTrackingData adAccountTrackingData = getGson().fromJson(json, AdAccountTrackingData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountTrackingData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountTrackingData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList adAccountTrackingDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountURLForAssetExtraction.java b/src/main/java/com/facebook/ads/sdk/AdAccountURLForAssetExtraction.java index 4b3eb175..f9484728 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountURLForAssetExtraction.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountURLForAssetExtraction.java @@ -56,9 +56,8 @@ public String getId() { public static AdAccountURLForAssetExtraction loadJSON(String json, APIContext context, String header) { AdAccountURLForAssetExtraction adAccountURLForAssetExtraction = getGson().fromJson(json, AdAccountURLForAssetExtraction.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountURLForAssetExtraction.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountURLForAssetExtraction.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String j APINodeList adAccountURLForAssetExtractions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountUser.java b/src/main/java/com/facebook/ads/sdk/AdAccountUser.java index 7ce806dd..42086220 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountUser.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountUser.java @@ -58,9 +58,8 @@ public String getId() { public static AdAccountUser loadJSON(String json, APIContext context, String header) { AdAccountUser adAccountUser = getGson().fromJson(json, AdAccountUser.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountUser.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountUser.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList adAccountUsers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountUserPermissions.java b/src/main/java/com/facebook/ads/sdk/AdAccountUserPermissions.java index 18bf21dd..baf745c7 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountUserPermissions.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountUserPermissions.java @@ -72,9 +72,8 @@ public String getId() { public static AdAccountUserPermissions loadJSON(String json, APIContext context, String header) { AdAccountUserPermissions adAccountUserPermissions = getGson().fromJson(json, AdAccountUserPermissions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountUserPermissions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountUserPermissions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -94,10 +93,9 @@ public static APINodeList parseResponse(String json, A APINodeList adAccountUserPermissionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountUserSettings.java b/src/main/java/com/facebook/ads/sdk/AdAccountUserSettings.java index 5959fbcf..3f5af874 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountUserSettings.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountUserSettings.java @@ -221,9 +221,8 @@ public String getId() { public static AdAccountUserSettings loadJSON(String json, APIContext context, String header) { AdAccountUserSettings adAccountUserSettings = getGson().fromJson(json, AdAccountUserSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountUserSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountUserSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -243,10 +242,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList adAccountUserSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAccountYouthAdsAdvertiser.java b/src/main/java/com/facebook/ads/sdk/AdAccountYouthAdsAdvertiser.java index 022c9616..77d271a4 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAccountYouthAdsAdvertiser.java +++ b/src/main/java/com/facebook/ads/sdk/AdAccountYouthAdsAdvertiser.java @@ -54,9 +54,8 @@ public String getId() { public static AdAccountYouthAdsAdvertiser loadJSON(String json, APIContext context, String header) { AdAccountYouthAdsAdvertiser adAccountYouthAdsAdvertiser = getGson().fromJson(json, AdAccountYouthAdsAdvertiser.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAccountYouthAdsAdvertiser.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAccountYouthAdsAdvertiser.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json APINodeList adAccountYouthAdsAdvertisers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdActivity.java b/src/main/java/com/facebook/ads/sdk/AdActivity.java index 650d525f..0abf91d9 100644 --- a/src/main/java/com/facebook/ads/sdk/AdActivity.java +++ b/src/main/java/com/facebook/ads/sdk/AdActivity.java @@ -76,9 +76,8 @@ public String getId() { public static AdActivity loadJSON(String json, APIContext context, String header) { AdActivity adActivity = getGson().fromJson(json, AdActivity.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adActivity.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adActivity.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -98,10 +97,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList adActivitys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetBody.java b/src/main/java/com/facebook/ads/sdk/AdAssetBody.java index 49e70d08..cbc0255b 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetBody.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetBody.java @@ -58,9 +58,8 @@ public String getId() { public static AdAssetBody loadJSON(String json, APIContext context, String header) { AdAssetBody adAssetBody = getGson().fromJson(json, AdAssetBody.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetBody.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetBody.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList adAssetBodys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetCallToActionType.java b/src/main/java/com/facebook/ads/sdk/AdAssetCallToActionType.java index 6eb056e7..08f1a2da 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetCallToActionType.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetCallToActionType.java @@ -56,9 +56,8 @@ public String getId() { public static AdAssetCallToActionType loadJSON(String json, APIContext context, String header) { AdAssetCallToActionType adAssetCallToActionType = getGson().fromJson(json, AdAssetCallToActionType.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetCallToActionType.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetCallToActionType.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, AP APINodeList adAssetCallToActionTypes = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetCustomizationRuleCustomizationSpec.java b/src/main/java/com/facebook/ads/sdk/AdAssetCustomizationRuleCustomizationSpec.java index e6c39272..3d8115d2 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetCustomizationRuleCustomizationSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetCustomizationRuleCustomizationSpec.java @@ -72,9 +72,8 @@ public String getId() { public static AdAssetCustomizationRuleCustomizationSpec loadJSON(String json, APIContext context, String header) { AdAssetCustomizationRuleCustomizationSpec adAssetCustomizationRuleCustomizationSpec = getGson().fromJson(json, AdAssetCustomizationRuleCustomizationSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetCustomizationRuleCustomizationSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetCustomizationRuleCustomizationSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -94,10 +93,9 @@ public static APINodeList parseRespon APINodeList adAssetCustomizationRuleCustomizationSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetDescription.java b/src/main/java/com/facebook/ads/sdk/AdAssetDescription.java index 2b840f12..ddd9d474 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetDescription.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetDescription.java @@ -58,9 +58,8 @@ public String getId() { public static AdAssetDescription loadJSON(String json, APIContext context, String header) { AdAssetDescription adAssetDescription = getGson().fromJson(json, AdAssetDescription.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetDescription.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetDescription.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList adAssetDescriptions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedAdditionalData.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedAdditionalData.java index 81123452..9aa88062 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedAdditionalData.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedAdditionalData.java @@ -64,9 +64,8 @@ public String getId() { public static AdAssetFeedAdditionalData loadJSON(String json, APIContext context, String header) { AdAssetFeedAdditionalData adAssetFeedAdditionalData = getGson().fromJson(json, AdAssetFeedAdditionalData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetFeedAdditionalData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetFeedAdditionalData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APINodeList adAssetFeedAdditionalDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedAdditionalDataPageNudgeMessage.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedAdditionalDataPageNudgeMessage.java index b126380f..a01bcf69 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedAdditionalDataPageNudgeMessage.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedAdditionalDataPageNudgeMessage.java @@ -58,9 +58,8 @@ public String getId() { public static AdAssetFeedAdditionalDataPageNudgeMessage loadJSON(String json, APIContext context, String header) { AdAssetFeedAdditionalDataPageNudgeMessage adAssetFeedAdditionalDataPageNudgeMessage = getGson().fromJson(json, AdAssetFeedAdditionalDataPageNudgeMessage.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetFeedAdditionalDataPageNudgeMessage.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetFeedAdditionalDataPageNudgeMessage.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseRespon APINodeList adAssetFeedAdditionalDataPageNudgeMessages = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpec.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpec.java index 2bf51d29..9b67167a 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpec.java @@ -102,9 +102,8 @@ public String getId() { public static AdAssetFeedSpec loadJSON(String json, APIContext context, String header) { AdAssetFeedSpec adAssetFeedSpec = getGson().fromJson(json, AdAssetFeedSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetFeedSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetFeedSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -124,10 +123,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adAssetFeedSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecAssetCustomizationRule.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecAssetCustomizationRule.java index 70b51cc6..85aac501 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecAssetCustomizationRule.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecAssetCustomizationRule.java @@ -78,9 +78,8 @@ public String getId() { public static AdAssetFeedSpecAssetCustomizationRule loadJSON(String json, APIContext context, String header) { AdAssetFeedSpecAssetCustomizationRule adAssetFeedSpecAssetCustomizationRule = getGson().fromJson(json, AdAssetFeedSpecAssetCustomizationRule.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetFeedSpecAssetCustomizationRule.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetFeedSpecAssetCustomizationRule.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -100,10 +99,9 @@ public static APINodeList parseResponse(S APINodeList adAssetFeedSpecAssetCustomizationRules = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecAssetLabel.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecAssetLabel.java index 9fe3d813..d87523a0 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecAssetLabel.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecAssetLabel.java @@ -56,9 +56,8 @@ public String getId() { public static AdAssetFeedSpecAssetLabel loadJSON(String json, APIContext context, String header) { AdAssetFeedSpecAssetLabel adAssetFeedSpecAssetLabel = getGson().fromJson(json, AdAssetFeedSpecAssetLabel.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetFeedSpecAssetLabel.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetFeedSpecAssetLabel.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APINodeList adAssetFeedSpecAssetLabels = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecBody.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecBody.java index 3fbf20cf..431e0266 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecBody.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecBody.java @@ -58,9 +58,8 @@ public String getId() { public static AdAssetFeedSpecBody loadJSON(String json, APIContext context, String header) { AdAssetFeedSpecBody adAssetFeedSpecBody = getGson().fromJson(json, AdAssetFeedSpecBody.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetFeedSpecBody.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetFeedSpecBody.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList adAssetFeedSpecBodys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCallToAction.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCallToAction.java index 699832c1..11aa0430 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCallToAction.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCallToAction.java @@ -58,9 +58,8 @@ public String getId() { public static AdAssetFeedSpecCallToAction loadJSON(String json, APIContext context, String header) { AdAssetFeedSpecCallToAction adAssetFeedSpecCallToAction = getGson().fromJson(json, AdAssetFeedSpecCallToAction.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetFeedSpecCallToAction.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetFeedSpecCallToAction.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json APINodeList adAssetFeedSpecCallToActions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCaption.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCaption.java index 5c044b7e..dffe20db 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCaption.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCaption.java @@ -58,9 +58,8 @@ public String getId() { public static AdAssetFeedSpecCaption loadJSON(String json, APIContext context, String header) { AdAssetFeedSpecCaption adAssetFeedSpecCaption = getGson().fromJson(json, AdAssetFeedSpecCaption.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetFeedSpecCaption.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetFeedSpecCaption.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, API APINodeList adAssetFeedSpecCaptions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCarousel.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCarousel.java index 8bcc265b..99e23380 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCarousel.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCarousel.java @@ -60,9 +60,8 @@ public String getId() { public static AdAssetFeedSpecCarousel loadJSON(String json, APIContext context, String header) { AdAssetFeedSpecCarousel adAssetFeedSpecCarousel = getGson().fromJson(json, AdAssetFeedSpecCarousel.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetFeedSpecCarousel.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetFeedSpecCarousel.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, AP APINodeList adAssetFeedSpecCarousels = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCarouselChildAttachment.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCarouselChildAttachment.java index 7b1a7073..10f9b8b5 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCarouselChildAttachment.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecCarouselChildAttachment.java @@ -72,9 +72,8 @@ public String getId() { public static AdAssetFeedSpecCarouselChildAttachment loadJSON(String json, APIContext context, String header) { AdAssetFeedSpecCarouselChildAttachment adAssetFeedSpecCarouselChildAttachment = getGson().fromJson(json, AdAssetFeedSpecCarouselChildAttachment.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetFeedSpecCarouselChildAttachment.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetFeedSpecCarouselChildAttachment.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -94,10 +93,9 @@ public static APINodeList parseResponse( APINodeList adAssetFeedSpecCarouselChildAttachments = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecDescription.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecDescription.java index 9fcd6cb0..486e05cb 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecDescription.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecDescription.java @@ -58,9 +58,8 @@ public String getId() { public static AdAssetFeedSpecDescription loadJSON(String json, APIContext context, String header) { AdAssetFeedSpecDescription adAssetFeedSpecDescription = getGson().fromJson(json, AdAssetFeedSpecDescription.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetFeedSpecDescription.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetFeedSpecDescription.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APINodeList adAssetFeedSpecDescriptions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecEvents.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecEvents.java index a029d4d8..f59b6cd1 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecEvents.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecEvents.java @@ -54,9 +54,8 @@ public String getId() { public static AdAssetFeedSpecEvents loadJSON(String json, APIContext context, String header) { AdAssetFeedSpecEvents adAssetFeedSpecEvents = getGson().fromJson(json, AdAssetFeedSpecEvents.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetFeedSpecEvents.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetFeedSpecEvents.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList adAssetFeedSpecEventss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecGroupRule.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecGroupRule.java index a442e7c1..6e82a644 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecGroupRule.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecGroupRule.java @@ -66,9 +66,8 @@ public String getId() { public static AdAssetFeedSpecGroupRule loadJSON(String json, APIContext context, String header) { AdAssetFeedSpecGroupRule adAssetFeedSpecGroupRule = getGson().fromJson(json, AdAssetFeedSpecGroupRule.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetFeedSpecGroupRule.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetFeedSpecGroupRule.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, A APINodeList adAssetFeedSpecGroupRules = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecImage.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecImage.java index d71dcdf5..0b00df57 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecImage.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecImage.java @@ -62,9 +62,8 @@ public String getId() { public static AdAssetFeedSpecImage loadJSON(String json, APIContext context, String header) { AdAssetFeedSpecImage adAssetFeedSpecImage = getGson().fromJson(json, AdAssetFeedSpecImage.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetFeedSpecImage.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetFeedSpecImage.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList adAssetFeedSpecImages = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecLinkURL.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecLinkURL.java index 792228f3..356d9951 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecLinkURL.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecLinkURL.java @@ -64,9 +64,8 @@ public String getId() { public static AdAssetFeedSpecLinkURL loadJSON(String json, APIContext context, String header) { AdAssetFeedSpecLinkURL adAssetFeedSpecLinkURL = getGson().fromJson(json, AdAssetFeedSpecLinkURL.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetFeedSpecLinkURL.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetFeedSpecLinkURL.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, API APINodeList adAssetFeedSpecLinkURLs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecTitle.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecTitle.java index d0c7bf57..bbf653fc 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecTitle.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecTitle.java @@ -58,9 +58,8 @@ public String getId() { public static AdAssetFeedSpecTitle loadJSON(String json, APIContext context, String header) { AdAssetFeedSpecTitle adAssetFeedSpecTitle = getGson().fromJson(json, AdAssetFeedSpecTitle.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetFeedSpecTitle.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetFeedSpecTitle.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList adAssetFeedSpecTitles = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecVideo.java b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecVideo.java index cc40383b..c7ee6396 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecVideo.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetFeedSpecVideo.java @@ -64,9 +64,8 @@ public String getId() { public static AdAssetFeedSpecVideo loadJSON(String json, APIContext context, String header) { AdAssetFeedSpecVideo adAssetFeedSpecVideo = getGson().fromJson(json, AdAssetFeedSpecVideo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetFeedSpecVideo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetFeedSpecVideo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList adAssetFeedSpecVideos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetImage.java b/src/main/java/com/facebook/ads/sdk/AdAssetImage.java index cd0f30d8..0ce9706b 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetImage.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetImage.java @@ -66,9 +66,8 @@ public String getId() { public static AdAssetImage loadJSON(String json, APIContext context, String header) { AdAssetImage adAssetImage = getGson().fromJson(json, AdAssetImage.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetImage.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetImage.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList adAssetImages = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetLinkURL.java b/src/main/java/com/facebook/ads/sdk/AdAssetLinkURL.java index a4058dff..af3fdee1 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetLinkURL.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetLinkURL.java @@ -70,9 +70,8 @@ public String getId() { public static AdAssetLinkURL loadJSON(String json, APIContext context, String header) { AdAssetLinkURL adAssetLinkURL = getGson().fromJson(json, AdAssetLinkURL.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetLinkURL.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetLinkURL.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adAssetLinkURLs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetMessageExtensions.java b/src/main/java/com/facebook/ads/sdk/AdAssetMessageExtensions.java index 8f386c14..def1a333 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetMessageExtensions.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetMessageExtensions.java @@ -54,9 +54,8 @@ public String getId() { public static AdAssetMessageExtensions loadJSON(String json, APIContext context, String header) { AdAssetMessageExtensions adAssetMessageExtensions = getGson().fromJson(json, AdAssetMessageExtensions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetMessageExtensions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetMessageExtensions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, A APINodeList adAssetMessageExtensionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetOnsiteDestinations.java b/src/main/java/com/facebook/ads/sdk/AdAssetOnsiteDestinations.java index 448cd583..c4fd6cb2 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetOnsiteDestinations.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetOnsiteDestinations.java @@ -60,9 +60,8 @@ public String getId() { public static AdAssetOnsiteDestinations loadJSON(String json, APIContext context, String header) { AdAssetOnsiteDestinations adAssetOnsiteDestinations = getGson().fromJson(json, AdAssetOnsiteDestinations.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetOnsiteDestinations.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetOnsiteDestinations.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APINodeList adAssetOnsiteDestinationss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetTargetRuleTargeting.java b/src/main/java/com/facebook/ads/sdk/AdAssetTargetRuleTargeting.java index 67d2810a..ac049aa9 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetTargetRuleTargeting.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetTargetRuleTargeting.java @@ -68,9 +68,8 @@ public String getId() { public static AdAssetTargetRuleTargeting loadJSON(String json, APIContext context, String header) { AdAssetTargetRuleTargeting adAssetTargetRuleTargeting = getGson().fromJson(json, AdAssetTargetRuleTargeting.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetTargetRuleTargeting.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetTargetRuleTargeting.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String json, APINodeList adAssetTargetRuleTargetings = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetTitle.java b/src/main/java/com/facebook/ads/sdk/AdAssetTitle.java index d7497705..6628edfa 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetTitle.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetTitle.java @@ -58,9 +58,8 @@ public String getId() { public static AdAssetTitle loadJSON(String json, APIContext context, String header) { AdAssetTitle adAssetTitle = getGson().fromJson(json, AdAssetTitle.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetTitle.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetTitle.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList adAssetTitles = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAssetVideo.java b/src/main/java/com/facebook/ads/sdk/AdAssetVideo.java index cc46def4..961e25d4 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAssetVideo.java +++ b/src/main/java/com/facebook/ads/sdk/AdAssetVideo.java @@ -74,9 +74,8 @@ public String getId() { public static AdAssetVideo loadJSON(String json, APIContext context, String header) { AdAssetVideo adAssetVideo = getGson().fromJson(json, AdAssetVideo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAssetVideo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAssetVideo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -96,10 +95,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList adAssetVideos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAsyncRequest.java b/src/main/java/com/facebook/ads/sdk/AdAsyncRequest.java index 5e38a47e..da6800a8 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAsyncRequest.java +++ b/src/main/java/com/facebook/ads/sdk/AdAsyncRequest.java @@ -129,9 +129,8 @@ public String getId() { public static AdAsyncRequest loadJSON(String json, APIContext context, String header) { AdAsyncRequest adAsyncRequest = getGson().fromJson(json, AdAsyncRequest.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAsyncRequest.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAsyncRequest.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adAsyncRequests = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAsyncRequestSet.java b/src/main/java/com/facebook/ads/sdk/AdAsyncRequestSet.java index dc8324e9..e3cca06e 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAsyncRequestSet.java +++ b/src/main/java/com/facebook/ads/sdk/AdAsyncRequestSet.java @@ -143,9 +143,8 @@ public String getId() { public static AdAsyncRequestSet loadJSON(String json, APIContext context, String header) { AdAsyncRequestSet adAsyncRequestSet = getGson().fromJson(json, AdAsyncRequestSet.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAsyncRequestSet.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAsyncRequestSet.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -165,10 +164,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList adAsyncRequestSets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdAsyncRequestSetNotificationResult.java b/src/main/java/com/facebook/ads/sdk/AdAsyncRequestSetNotificationResult.java index 6c3f0f62..c9c1da0d 100644 --- a/src/main/java/com/facebook/ads/sdk/AdAsyncRequestSetNotificationResult.java +++ b/src/main/java/com/facebook/ads/sdk/AdAsyncRequestSetNotificationResult.java @@ -56,9 +56,8 @@ public String getId() { public static AdAsyncRequestSetNotificationResult loadJSON(String json, APIContext context, String header) { AdAsyncRequestSetNotificationResult adAsyncRequestSetNotificationResult = getGson().fromJson(json, AdAsyncRequestSetNotificationResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adAsyncRequestSetNotificationResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adAsyncRequestSetNotificationResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(Str APINodeList adAsyncRequestSetNotificationResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdBidAdjustments.java b/src/main/java/com/facebook/ads/sdk/AdBidAdjustments.java index 6f9b91a7..0930a99c 100644 --- a/src/main/java/com/facebook/ads/sdk/AdBidAdjustments.java +++ b/src/main/java/com/facebook/ads/sdk/AdBidAdjustments.java @@ -58,9 +58,8 @@ public String getId() { public static AdBidAdjustments loadJSON(String json, APIContext context, String header) { AdBidAdjustments adBidAdjustments = getGson().fromJson(json, AdBidAdjustments.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adBidAdjustments.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adBidAdjustments.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList adBidAdjustmentss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignBidConstraint.java b/src/main/java/com/facebook/ads/sdk/AdCampaignBidConstraint.java index 7e13a831..4bec9840 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCampaignBidConstraint.java +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignBidConstraint.java @@ -54,9 +54,8 @@ public String getId() { public static AdCampaignBidConstraint loadJSON(String json, APIContext context, String header) { AdCampaignBidConstraint adCampaignBidConstraint = getGson().fromJson(json, AdCampaignBidConstraint.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCampaignBidConstraint.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCampaignBidConstraint.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, AP APINodeList adCampaignBidConstraints = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignConversionValueExpressionSpec.java b/src/main/java/com/facebook/ads/sdk/AdCampaignConversionValueExpressionSpec.java index 902c5f8d..50a00c77 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCampaignConversionValueExpressionSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignConversionValueExpressionSpec.java @@ -58,9 +58,8 @@ public String getId() { public static AdCampaignConversionValueExpressionSpec loadJSON(String json, APIContext context, String header) { AdCampaignConversionValueExpressionSpec adCampaignConversionValueExpressionSpec = getGson().fromJson(json, AdCampaignConversionValueExpressionSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCampaignConversionValueExpressionSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCampaignConversionValueExpressionSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse APINodeList adCampaignConversionValueExpressionSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignDeliveryEstimate.java b/src/main/java/com/facebook/ads/sdk/AdCampaignDeliveryEstimate.java index 6b295ed7..eb92bd38 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCampaignDeliveryEstimate.java +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignDeliveryEstimate.java @@ -64,9 +64,8 @@ public String getId() { public static AdCampaignDeliveryEstimate loadJSON(String json, APIContext context, String header) { AdCampaignDeliveryEstimate adCampaignDeliveryEstimate = getGson().fromJson(json, AdCampaignDeliveryEstimate.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCampaignDeliveryEstimate.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCampaignDeliveryEstimate.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APINodeList adCampaignDeliveryEstimates = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignDeliveryStats.java b/src/main/java/com/facebook/ads/sdk/AdCampaignDeliveryStats.java index 04e81650..7e5fa8c9 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCampaignDeliveryStats.java +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignDeliveryStats.java @@ -64,9 +64,8 @@ public String getId() { public static AdCampaignDeliveryStats loadJSON(String json, APIContext context, String header) { AdCampaignDeliveryStats adCampaignDeliveryStats = getGson().fromJson(json, AdCampaignDeliveryStats.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCampaignDeliveryStats.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCampaignDeliveryStats.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, AP APINodeList adCampaignDeliveryStatss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignDeliveryStatsUnsupportedReasons.java b/src/main/java/com/facebook/ads/sdk/AdCampaignDeliveryStatsUnsupportedReasons.java index ccd83f97..60cf0d13 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCampaignDeliveryStatsUnsupportedReasons.java +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignDeliveryStatsUnsupportedReasons.java @@ -56,9 +56,8 @@ public String getId() { public static AdCampaignDeliveryStatsUnsupportedReasons loadJSON(String json, APIContext context, String header) { AdCampaignDeliveryStatsUnsupportedReasons adCampaignDeliveryStatsUnsupportedReasons = getGson().fromJson(json, AdCampaignDeliveryStatsUnsupportedReasons.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCampaignDeliveryStatsUnsupportedReasons.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCampaignDeliveryStatsUnsupportedReasons.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseRespon APINodeList adCampaignDeliveryStatsUnsupportedReasonss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignFrequencyControlSpecs.java b/src/main/java/com/facebook/ads/sdk/AdCampaignFrequencyControlSpecs.java index 610ec2b5..c366b27c 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCampaignFrequencyControlSpecs.java +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignFrequencyControlSpecs.java @@ -58,9 +58,8 @@ public String getId() { public static AdCampaignFrequencyControlSpecs loadJSON(String json, APIContext context, String header) { AdCampaignFrequencyControlSpecs adCampaignFrequencyControlSpecs = getGson().fromJson(json, AdCampaignFrequencyControlSpecs.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCampaignFrequencyControlSpecs.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCampaignFrequencyControlSpecs.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String APINodeList adCampaignFrequencyControlSpecss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignGroupIncrementalConversionOptimizationConfig.java b/src/main/java/com/facebook/ads/sdk/AdCampaignGroupIncrementalConversionOptimizationConfig.java index 00515e8e..aeb39082 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCampaignGroupIncrementalConversionOptimizationConfig.java +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignGroupIncrementalConversionOptimizationConfig.java @@ -72,9 +72,8 @@ public String getId() { public static AdCampaignGroupIncrementalConversionOptimizationConfig loadJSON(String json, APIContext context, String header) { AdCampaignGroupIncrementalConversionOptimizationConfig adCampaignGroupIncrementalConversionOptimizationConfig = getGson().fromJson(json, AdCampaignGroupIncrementalConversionOptimizationConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCampaignGroupIncrementalConversionOptimizationConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCampaignGroupIncrementalConversionOptimizationConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -94,10 +93,9 @@ public static APINodeList adCampaignGroupIncrementalConversionOptimizationConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignGroupMetricsMetadata.java b/src/main/java/com/facebook/ads/sdk/AdCampaignGroupMetricsMetadata.java index 08e327db..c6309583 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCampaignGroupMetricsMetadata.java +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignGroupMetricsMetadata.java @@ -56,9 +56,8 @@ public String getId() { public static AdCampaignGroupMetricsMetadata loadJSON(String json, APIContext context, String header) { AdCampaignGroupMetricsMetadata adCampaignGroupMetricsMetadata = getGson().fromJson(json, AdCampaignGroupMetricsMetadata.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCampaignGroupMetricsMetadata.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCampaignGroupMetricsMetadata.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String j APINodeList adCampaignGroupMetricsMetadatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignGroupStats.java b/src/main/java/com/facebook/ads/sdk/AdCampaignGroupStats.java index 23b11858..4d108a85 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCampaignGroupStats.java +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignGroupStats.java @@ -82,9 +82,8 @@ public String getId() { public static AdCampaignGroupStats loadJSON(String json, APIContext context, String header) { AdCampaignGroupStats adCampaignGroupStats = getGson().fromJson(json, AdCampaignGroupStats.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCampaignGroupStats.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCampaignGroupStats.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -104,10 +103,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList adCampaignGroupStatss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignGroupStructureTree.java b/src/main/java/com/facebook/ads/sdk/AdCampaignGroupStructureTree.java index 410a3ce2..3ed38e92 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCampaignGroupStructureTree.java +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignGroupStructureTree.java @@ -60,9 +60,8 @@ public String getId() { public static AdCampaignGroupStructureTree loadJSON(String json, APIContext context, String header) { AdCampaignGroupStructureTree adCampaignGroupStructureTree = getGson().fromJson(json, AdCampaignGroupStructureTree.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCampaignGroupStructureTree.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCampaignGroupStructureTree.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String jso APINodeList adCampaignGroupStructureTrees = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignIssuesInfo.java b/src/main/java/com/facebook/ads/sdk/AdCampaignIssuesInfo.java index bc1b286a..fb7b2d10 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCampaignIssuesInfo.java +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignIssuesInfo.java @@ -62,9 +62,8 @@ public String getId() { public static AdCampaignIssuesInfo loadJSON(String json, APIContext context, String header) { AdCampaignIssuesInfo adCampaignIssuesInfo = getGson().fromJson(json, AdCampaignIssuesInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCampaignIssuesInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCampaignIssuesInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList adCampaignIssuesInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignLearningStageInfo.java b/src/main/java/com/facebook/ads/sdk/AdCampaignLearningStageInfo.java index cc1ab541..ac4f7d2b 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCampaignLearningStageInfo.java +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignLearningStageInfo.java @@ -60,9 +60,8 @@ public String getId() { public static AdCampaignLearningStageInfo loadJSON(String json, APIContext context, String header) { AdCampaignLearningStageInfo adCampaignLearningStageInfo = getGson().fromJson(json, AdCampaignLearningStageInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCampaignLearningStageInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCampaignLearningStageInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json APINodeList adCampaignLearningStageInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignMetricsMetadata.java b/src/main/java/com/facebook/ads/sdk/AdCampaignMetricsMetadata.java index 2bdf5a14..b03e99ed 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCampaignMetricsMetadata.java +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignMetricsMetadata.java @@ -64,9 +64,8 @@ public String getId() { public static AdCampaignMetricsMetadata loadJSON(String json, APIContext context, String header) { AdCampaignMetricsMetadata adCampaignMetricsMetadata = getGson().fromJson(json, AdCampaignMetricsMetadata.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCampaignMetricsMetadata.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCampaignMetricsMetadata.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APINodeList adCampaignMetricsMetadatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignMultiAds.java b/src/main/java/com/facebook/ads/sdk/AdCampaignMultiAds.java index 1b7b11ba..a42a0dcd 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCampaignMultiAds.java +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignMultiAds.java @@ -56,9 +56,8 @@ public String getId() { public static AdCampaignMultiAds loadJSON(String json, APIContext context, String header) { AdCampaignMultiAds adCampaignMultiAds = getGson().fromJson(json, AdCampaignMultiAds.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCampaignMultiAds.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCampaignMultiAds.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList adCampaignMultiAdss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignOptimizationEvent.java b/src/main/java/com/facebook/ads/sdk/AdCampaignOptimizationEvent.java index d5611918..ed49b680 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCampaignOptimizationEvent.java +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignOptimizationEvent.java @@ -58,9 +58,8 @@ public String getId() { public static AdCampaignOptimizationEvent loadJSON(String json, APIContext context, String header) { AdCampaignOptimizationEvent adCampaignOptimizationEvent = getGson().fromJson(json, AdCampaignOptimizationEvent.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCampaignOptimizationEvent.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCampaignOptimizationEvent.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json APINodeList adCampaignOptimizationEvents = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignPacedBidInfo.java b/src/main/java/com/facebook/ads/sdk/AdCampaignPacedBidInfo.java index 3575872f..309665af 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCampaignPacedBidInfo.java +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignPacedBidInfo.java @@ -54,9 +54,8 @@ public String getId() { public static AdCampaignPacedBidInfo loadJSON(String json, APIContext context, String header) { AdCampaignPacedBidInfo adCampaignPacedBidInfo = getGson().fromJson(json, AdCampaignPacedBidInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCampaignPacedBidInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCampaignPacedBidInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, API APINodeList adCampaignPacedBidInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCampaignStats.java b/src/main/java/com/facebook/ads/sdk/AdCampaignStats.java index 6e65e5ef..76f2ea00 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCampaignStats.java +++ b/src/main/java/com/facebook/ads/sdk/AdCampaignStats.java @@ -100,9 +100,8 @@ public String getId() { public static AdCampaignStats loadJSON(String json, APIContext context, String header) { AdCampaignStats adCampaignStats = getGson().fromJson(json, AdCampaignStats.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCampaignStats.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCampaignStats.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -122,10 +121,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adCampaignStatss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdColumnSizes.java b/src/main/java/com/facebook/ads/sdk/AdColumnSizes.java index a15e9037..1f50c9b9 100644 --- a/src/main/java/com/facebook/ads/sdk/AdColumnSizes.java +++ b/src/main/java/com/facebook/ads/sdk/AdColumnSizes.java @@ -129,9 +129,8 @@ public String getId() { public static AdColumnSizes loadJSON(String json, APIContext context, String header) { AdColumnSizes adColumnSizes = getGson().fromJson(json, AdColumnSizes.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adColumnSizes.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adColumnSizes.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList adColumnSizess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdContract.java b/src/main/java/com/facebook/ads/sdk/AdContract.java index 76d7836a..60d1f6c9 100644 --- a/src/main/java/com/facebook/ads/sdk/AdContract.java +++ b/src/main/java/com/facebook/ads/sdk/AdContract.java @@ -134,9 +134,8 @@ public String getId() { public static AdContract loadJSON(String json, APIContext context, String header) { AdContract adContract = getGson().fromJson(json, AdContract.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adContract.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adContract.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -156,10 +155,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList adContracts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdConversionValues.java b/src/main/java/com/facebook/ads/sdk/AdConversionValues.java index 0bc22142..a74aa82c 100644 --- a/src/main/java/com/facebook/ads/sdk/AdConversionValues.java +++ b/src/main/java/com/facebook/ads/sdk/AdConversionValues.java @@ -58,9 +58,8 @@ public String getId() { public static AdConversionValues loadJSON(String json, APIContext context, String header) { AdConversionValues adConversionValues = getGson().fromJson(json, AdConversionValues.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adConversionValues.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adConversionValues.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList adConversionValuess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdConversions.java b/src/main/java/com/facebook/ads/sdk/AdConversions.java index 0430b85e..6e727491 100644 --- a/src/main/java/com/facebook/ads/sdk/AdConversions.java +++ b/src/main/java/com/facebook/ads/sdk/AdConversions.java @@ -60,9 +60,8 @@ public String getId() { public static AdConversions loadJSON(String json, APIContext context, String header) { AdConversions adConversions = getGson().fromJson(json, AdConversions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adConversions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adConversions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList adConversionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreationPackageConfig.java b/src/main/java/com/facebook/ads/sdk/AdCreationPackageConfig.java index 8abeff01..21b8bd26 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreationPackageConfig.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreationPackageConfig.java @@ -123,9 +123,8 @@ public String getId() { public static AdCreationPackageConfig loadJSON(String json, APIContext context, String header) { AdCreationPackageConfig adCreationPackageConfig = getGson().fromJson(json, AdCreationPackageConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreationPackageConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreationPackageConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String json, AP APINodeList adCreationPackageConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreative.java b/src/main/java/com/facebook/ads/sdk/AdCreative.java index 85b2f0df..e0f9a9cc 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreative.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreative.java @@ -251,9 +251,8 @@ public String getId() { public static AdCreative loadJSON(String json, APIContext context, String header) { AdCreative adCreative = getGson().fromJson(json, AdCreative.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreative.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreative.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -274,10 +273,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList adCreatives = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeAdDisclaimer.java b/src/main/java/com/facebook/ads/sdk/AdCreativeAdDisclaimer.java index f4373c68..a6bb1328 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeAdDisclaimer.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeAdDisclaimer.java @@ -58,9 +58,8 @@ public String getId() { public static AdCreativeAdDisclaimer loadJSON(String json, APIContext context, String header) { AdCreativeAdDisclaimer adCreativeAdDisclaimer = getGson().fromJson(json, AdCreativeAdDisclaimer.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeAdDisclaimer.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeAdDisclaimer.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, API APINodeList adCreativeAdDisclaimers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeAssetGroupsSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeAssetGroupsSpec.java index 277c9149..021af66a 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeAssetGroupsSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeAssetGroupsSpec.java @@ -56,9 +56,8 @@ public String getId() { public static AdCreativeAssetGroupsSpec loadJSON(String json, APIContext context, String header) { AdCreativeAssetGroupsSpec adCreativeAssetGroupsSpec = getGson().fromJson(json, AdCreativeAssetGroupsSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeAssetGroupsSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeAssetGroupsSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APINodeList adCreativeAssetGroupsSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAds.java b/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAds.java index a65f2652..3ed02303 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAds.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAds.java @@ -78,9 +78,8 @@ public String getId() { public static AdCreativeBrandedContentAds loadJSON(String json, APIContext context, String header) { AdCreativeBrandedContentAds adCreativeBrandedContentAds = getGson().fromJson(json, AdCreativeBrandedContentAds.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeBrandedContentAds.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeBrandedContentAds.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -100,10 +99,9 @@ public static APINodeList parseResponse(String json APINodeList adCreativeBrandedContentAdss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAdsPartners.java b/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAdsPartners.java index 462a8c17..53270811 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAdsPartners.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeBrandedContentAdsPartners.java @@ -62,9 +62,8 @@ public String getId() { public static AdCreativeBrandedContentAdsPartners loadJSON(String json, APIContext context, String header) { AdCreativeBrandedContentAdsPartners adCreativeBrandedContentAdsPartners = getGson().fromJson(json, AdCreativeBrandedContentAdsPartners.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeBrandedContentAdsPartners.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeBrandedContentAdsPartners.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(Str APINodeList adCreativeBrandedContentAdsPartnerss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeCollectionThumbnailInfo.java b/src/main/java/com/facebook/ads/sdk/AdCreativeCollectionThumbnailInfo.java index 5da2f59d..4e9e4f25 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeCollectionThumbnailInfo.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeCollectionThumbnailInfo.java @@ -58,9 +58,8 @@ public String getId() { public static AdCreativeCollectionThumbnailInfo loadJSON(String json, APIContext context, String header) { AdCreativeCollectionThumbnailInfo adCreativeCollectionThumbnailInfo = getGson().fromJson(json, AdCreativeCollectionThumbnailInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeCollectionThumbnailInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeCollectionThumbnailInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(Strin APINodeList adCreativeCollectionThumbnailInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeContextualMultiAds.java b/src/main/java/com/facebook/ads/sdk/AdCreativeContextualMultiAds.java index d39081d1..50ff1d15 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeContextualMultiAds.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeContextualMultiAds.java @@ -54,9 +54,8 @@ public String getId() { public static AdCreativeContextualMultiAds loadJSON(String json, APIContext context, String header) { AdCreativeContextualMultiAds adCreativeContextualMultiAds = getGson().fromJson(json, AdCreativeContextualMultiAds.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeContextualMultiAds.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeContextualMultiAds.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String jso APINodeList adCreativeContextualMultiAdss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeDegreesOfFreedomSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeDegreesOfFreedomSpec.java index a6fd78d4..d97adba1 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeDegreesOfFreedomSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeDegreesOfFreedomSpec.java @@ -68,9 +68,8 @@ public String getId() { public static AdCreativeDegreesOfFreedomSpec loadJSON(String json, APIContext context, String header) { AdCreativeDegreesOfFreedomSpec adCreativeDegreesOfFreedomSpec = getGson().fromJson(json, AdCreativeDegreesOfFreedomSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeDegreesOfFreedomSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeDegreesOfFreedomSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String j APINodeList adCreativeDegreesOfFreedomSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeDestinationSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeDestinationSpec.java index b14cef90..9e926150 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeDestinationSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeDestinationSpec.java @@ -54,9 +54,8 @@ public String getId() { public static AdCreativeDestinationSpec loadJSON(String json, APIContext context, String header) { AdCreativeDestinationSpec adCreativeDestinationSpec = getGson().fromJson(json, AdCreativeDestinationSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeDestinationSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeDestinationSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APINodeList adCreativeDestinationSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeFacebookBrandedContent.java b/src/main/java/com/facebook/ads/sdk/AdCreativeFacebookBrandedContent.java index 7e33802f..9354dc82 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeFacebookBrandedContent.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeFacebookBrandedContent.java @@ -58,9 +58,8 @@ public String getId() { public static AdCreativeFacebookBrandedContent loadJSON(String json, APIContext context, String header) { AdCreativeFacebookBrandedContent adCreativeFacebookBrandedContent = getGson().fromJson(json, AdCreativeFacebookBrandedContent.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeFacebookBrandedContent.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeFacebookBrandedContent.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String APINodeList adCreativeFacebookBrandedContents = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeFeatureActionMetadata.java b/src/main/java/com/facebook/ads/sdk/AdCreativeFeatureActionMetadata.java index 667ebf55..d442ba1c 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeFeatureActionMetadata.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeFeatureActionMetadata.java @@ -54,9 +54,8 @@ public String getId() { public static AdCreativeFeatureActionMetadata loadJSON(String json, APIContext context, String header) { AdCreativeFeatureActionMetadata adCreativeFeatureActionMetadata = getGson().fromJson(json, AdCreativeFeatureActionMetadata.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeFeatureActionMetadata.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeFeatureActionMetadata.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String APINodeList adCreativeFeatureActionMetadatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeFeatureCustomizations.java b/src/main/java/com/facebook/ads/sdk/AdCreativeFeatureCustomizations.java index 93de90f0..e6f01908 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeFeatureCustomizations.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeFeatureCustomizations.java @@ -54,9 +54,8 @@ public String getId() { public static AdCreativeFeatureCustomizations loadJSON(String json, APIContext context, String header) { AdCreativeFeatureCustomizations adCreativeFeatureCustomizations = getGson().fromJson(json, AdCreativeFeatureCustomizations.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeFeatureCustomizations.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeFeatureCustomizations.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String APINodeList adCreativeFeatureCustomizationss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeFeatureDetails.java b/src/main/java/com/facebook/ads/sdk/AdCreativeFeatureDetails.java index 4f983f81..4c531a50 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeFeatureDetails.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeFeatureDetails.java @@ -56,9 +56,8 @@ public String getId() { public static AdCreativeFeatureDetails loadJSON(String json, APIContext context, String header) { AdCreativeFeatureDetails adCreativeFeatureDetails = getGson().fromJson(json, AdCreativeFeatureDetails.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeFeatureDetails.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeFeatureDetails.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, A APINodeList adCreativeFeatureDetailss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeFeaturesSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeFeaturesSpec.java index 77728532..a76a4343 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeFeaturesSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeFeaturesSpec.java @@ -150,9 +150,8 @@ public String getId() { public static AdCreativeFeaturesSpec loadJSON(String json, APIContext context, String header) { AdCreativeFeaturesSpec adCreativeFeaturesSpec = getGson().fromJson(json, AdCreativeFeaturesSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeFeaturesSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeFeaturesSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -172,10 +171,9 @@ public static APINodeList parseResponse(String json, API APINodeList adCreativeFeaturesSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeGenerativeAssetSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeGenerativeAssetSpec.java index 9d9534f8..1f5f3bab 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeGenerativeAssetSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeGenerativeAssetSpec.java @@ -52,9 +52,8 @@ public String getId() { public static AdCreativeGenerativeAssetSpec loadJSON(String json, APIContext context, String header) { AdCreativeGenerativeAssetSpec adCreativeGenerativeAssetSpec = getGson().fromJson(json, AdCreativeGenerativeAssetSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeGenerativeAssetSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeGenerativeAssetSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseResponse(String js APINodeList adCreativeGenerativeAssetSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeHouseShopsAdsSellerContent.java b/src/main/java/com/facebook/ads/sdk/AdCreativeHouseShopsAdsSellerContent.java index a61f6d6c..a1c345b0 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeHouseShopsAdsSellerContent.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeHouseShopsAdsSellerContent.java @@ -52,9 +52,8 @@ public String getId() { public static AdCreativeHouseShopsAdsSellerContent loadJSON(String json, APIContext context, String header) { AdCreativeHouseShopsAdsSellerContent adCreativeHouseShopsAdsSellerContent = getGson().fromJson(json, AdCreativeHouseShopsAdsSellerContent.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeHouseShopsAdsSellerContent.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeHouseShopsAdsSellerContent.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseResponse(St APINodeList adCreativeHouseShopsAdsSellerContents = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeImageDataMediaElements.java b/src/main/java/com/facebook/ads/sdk/AdCreativeImageDataMediaElements.java index d720e3c1..1f25d4b0 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeImageDataMediaElements.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeImageDataMediaElements.java @@ -60,9 +60,8 @@ public String getId() { public static AdCreativeImageDataMediaElements loadJSON(String json, APIContext context, String header) { AdCreativeImageDataMediaElements adCreativeImageDataMediaElements = getGson().fromJson(json, AdCreativeImageDataMediaElements.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeImageDataMediaElements.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeImageDataMediaElements.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String APINodeList adCreativeImageDataMediaElementss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeInsights.java b/src/main/java/com/facebook/ads/sdk/AdCreativeInsights.java index 73afd4d3..872ac8d9 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeInsights.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeInsights.java @@ -54,9 +54,8 @@ public String getId() { public static AdCreativeInsights loadJSON(String json, APIContext context, String header) { AdCreativeInsights adCreativeInsights = getGson().fromJson(json, AdCreativeInsights.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeInsights.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeInsights.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList adCreativeInsightss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeInstagramBrandedContent.java b/src/main/java/com/facebook/ads/sdk/AdCreativeInstagramBrandedContent.java index 43cc4261..30a3a97e 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeInstagramBrandedContent.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeInstagramBrandedContent.java @@ -54,9 +54,8 @@ public String getId() { public static AdCreativeInstagramBrandedContent loadJSON(String json, APIContext context, String header) { AdCreativeInstagramBrandedContent adCreativeInstagramBrandedContent = getGson().fromJson(json, AdCreativeInstagramBrandedContent.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeInstagramBrandedContent.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeInstagramBrandedContent.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(Strin APINodeList adCreativeInstagramBrandedContents = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeInteractiveComponentsSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeInteractiveComponentsSpec.java index 3ec5f231..09f6edd5 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeInteractiveComponentsSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeInteractiveComponentsSpec.java @@ -56,9 +56,8 @@ public String getId() { public static AdCreativeInteractiveComponentsSpec loadJSON(String json, APIContext context, String header) { AdCreativeInteractiveComponentsSpec adCreativeInteractiveComponentsSpec = getGson().fromJson(json, AdCreativeInteractiveComponentsSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeInteractiveComponentsSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeInteractiveComponentsSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(Str APINodeList adCreativeInteractiveComponentsSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkData.java b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkData.java index d2620262..f407ba58 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkData.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkData.java @@ -122,9 +122,8 @@ public String getId() { public static AdCreativeLinkData loadJSON(String json, APIContext context, String header) { AdCreativeLinkData adCreativeLinkData = getGson().fromJson(json, AdCreativeLinkData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeLinkData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeLinkData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -144,10 +143,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList adCreativeLinkDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataAppLinkSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataAppLinkSpec.java index db195344..fc21677c 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataAppLinkSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataAppLinkSpec.java @@ -60,9 +60,8 @@ public String getId() { public static AdCreativeLinkDataAppLinkSpec loadJSON(String json, APIContext context, String header) { AdCreativeLinkDataAppLinkSpec adCreativeLinkDataAppLinkSpec = getGson().fromJson(json, AdCreativeLinkDataAppLinkSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeLinkDataAppLinkSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeLinkDataAppLinkSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String js APINodeList adCreativeLinkDataAppLinkSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCallToAction.java b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCallToAction.java index 44011289..8f9c8501 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCallToAction.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCallToAction.java @@ -56,9 +56,8 @@ public String getId() { public static AdCreativeLinkDataCallToAction loadJSON(String json, APIContext context, String header) { AdCreativeLinkDataCallToAction adCreativeLinkDataCallToAction = getGson().fromJson(json, AdCreativeLinkDataCallToAction.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeLinkDataCallToAction.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeLinkDataCallToAction.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String j APINodeList adCreativeLinkDataCallToActions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCallToActionValue.java b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCallToActionValue.java index 5f8ea248..c6e47f4b 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCallToActionValue.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCallToActionValue.java @@ -76,9 +76,8 @@ public String getId() { public static AdCreativeLinkDataCallToActionValue loadJSON(String json, APIContext context, String header) { AdCreativeLinkDataCallToActionValue adCreativeLinkDataCallToActionValue = getGson().fromJson(json, AdCreativeLinkDataCallToActionValue.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeLinkDataCallToActionValue.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeLinkDataCallToActionValue.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -98,10 +97,9 @@ public static APINodeList parseResponse(Str APINodeList adCreativeLinkDataCallToActionValues = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataChildAttachment.java b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataChildAttachment.java index 3a7f0542..090a54bf 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataChildAttachment.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataChildAttachment.java @@ -74,9 +74,8 @@ public String getId() { public static AdCreativeLinkDataChildAttachment loadJSON(String json, APIContext context, String header) { AdCreativeLinkDataChildAttachment adCreativeLinkDataChildAttachment = getGson().fromJson(json, AdCreativeLinkDataChildAttachment.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeLinkDataChildAttachment.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeLinkDataChildAttachment.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -96,10 +95,9 @@ public static APINodeList parseResponse(Strin APINodeList adCreativeLinkDataChildAttachments = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCustomOverlaySpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCustomOverlaySpec.java index a86fedd9..22b6c062 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCustomOverlaySpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataCustomOverlaySpec.java @@ -68,9 +68,8 @@ public String getId() { public static AdCreativeLinkDataCustomOverlaySpec loadJSON(String json, APIContext context, String header) { AdCreativeLinkDataCustomOverlaySpec adCreativeLinkDataCustomOverlaySpec = getGson().fromJson(json, AdCreativeLinkDataCustomOverlaySpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeLinkDataCustomOverlaySpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeLinkDataCustomOverlaySpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(Str APINodeList adCreativeLinkDataCustomOverlaySpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataImageLayerSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataImageLayerSpec.java index 2e6775a1..4b7b904c 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataImageLayerSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataImageLayerSpec.java @@ -80,9 +80,8 @@ public String getId() { public static AdCreativeLinkDataImageLayerSpec loadJSON(String json, APIContext context, String header) { AdCreativeLinkDataImageLayerSpec adCreativeLinkDataImageLayerSpec = getGson().fromJson(json, AdCreativeLinkDataImageLayerSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeLinkDataImageLayerSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeLinkDataImageLayerSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -102,10 +101,9 @@ public static APINodeList parseResponse(String APINodeList adCreativeLinkDataImageLayerSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataImageOverlaySpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataImageOverlaySpec.java index e264e5a5..6f488591 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataImageOverlaySpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataImageOverlaySpec.java @@ -68,9 +68,8 @@ public String getId() { public static AdCreativeLinkDataImageOverlaySpec loadJSON(String json, APIContext context, String header) { AdCreativeLinkDataImageOverlaySpec adCreativeLinkDataImageOverlaySpec = getGson().fromJson(json, AdCreativeLinkDataImageOverlaySpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeLinkDataImageOverlaySpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeLinkDataImageOverlaySpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(Stri APINodeList adCreativeLinkDataImageOverlaySpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataMoment.java b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataMoment.java index 03b0af68..77803709 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataMoment.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataMoment.java @@ -56,9 +56,8 @@ public String getId() { public static AdCreativeLinkDataMoment loadJSON(String json, APIContext context, String header) { AdCreativeLinkDataMoment adCreativeLinkDataMoment = getGson().fromJson(json, AdCreativeLinkDataMoment.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeLinkDataMoment.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeLinkDataMoment.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, A APINodeList adCreativeLinkDataMoments = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataSponsorshipInfoSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataSponsorshipInfoSpec.java index 177c0c1b..137ce261 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataSponsorshipInfoSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataSponsorshipInfoSpec.java @@ -56,9 +56,8 @@ public String getId() { public static AdCreativeLinkDataSponsorshipInfoSpec loadJSON(String json, APIContext context, String header) { AdCreativeLinkDataSponsorshipInfoSpec adCreativeLinkDataSponsorshipInfoSpec = getGson().fromJson(json, AdCreativeLinkDataSponsorshipInfoSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeLinkDataSponsorshipInfoSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeLinkDataSponsorshipInfoSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(S APINodeList adCreativeLinkDataSponsorshipInfoSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataTemplateVideoSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataTemplateVideoSpec.java index 3a737e2b..675e1d33 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataTemplateVideoSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeLinkDataTemplateVideoSpec.java @@ -58,9 +58,8 @@ public String getId() { public static AdCreativeLinkDataTemplateVideoSpec loadJSON(String json, APIContext context, String header) { AdCreativeLinkDataTemplateVideoSpec adCreativeLinkDataTemplateVideoSpec = getGson().fromJson(json, AdCreativeLinkDataTemplateVideoSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeLinkDataTemplateVideoSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeLinkDataTemplateVideoSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(Str APINodeList adCreativeLinkDataTemplateVideoSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeMarketingMessageStructuredSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeMarketingMessageStructuredSpec.java index 9a06519d..270ac510 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeMarketingMessageStructuredSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeMarketingMessageStructuredSpec.java @@ -66,9 +66,8 @@ public String getId() { public static AdCreativeMarketingMessageStructuredSpec loadJSON(String json, APIContext context, String header) { AdCreativeMarketingMessageStructuredSpec adCreativeMarketingMessageStructuredSpec = getGson().fromJson(json, AdCreativeMarketingMessageStructuredSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeMarketingMessageStructuredSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeMarketingMessageStructuredSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseRespons APINodeList adCreativeMarketingMessageStructuredSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeObjectStorySpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeObjectStorySpec.java index 58d07e52..cde72b25 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeObjectStorySpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeObjectStorySpec.java @@ -70,9 +70,8 @@ public String getId() { public static AdCreativeObjectStorySpec loadJSON(String json, APIContext context, String header) { AdCreativeObjectStorySpec adCreativeObjectStorySpec = getGson().fromJson(json, AdCreativeObjectStorySpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeObjectStorySpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeObjectStorySpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse(String json, APINodeList adCreativeObjectStorySpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeOmnichannelLinkSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeOmnichannelLinkSpec.java index 87de7aac..a1d7f81c 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeOmnichannelLinkSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeOmnichannelLinkSpec.java @@ -56,9 +56,8 @@ public String getId() { public static AdCreativeOmnichannelLinkSpec loadJSON(String json, APIContext context, String header) { AdCreativeOmnichannelLinkSpec adCreativeOmnichannelLinkSpec = getGson().fromJson(json, AdCreativeOmnichannelLinkSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeOmnichannelLinkSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeOmnichannelLinkSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String js APINodeList adCreativeOmnichannelLinkSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativePhotoData.java b/src/main/java/com/facebook/ads/sdk/AdCreativePhotoData.java index ceee3c0d..ffba5502 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativePhotoData.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativePhotoData.java @@ -64,9 +64,8 @@ public String getId() { public static AdCreativePhotoData loadJSON(String json, APIContext context, String header) { AdCreativePhotoData adCreativePhotoData = getGson().fromJson(json, AdCreativePhotoData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativePhotoData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativePhotoData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList adCreativePhotoDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativePhotoDataMediaElements.java b/src/main/java/com/facebook/ads/sdk/AdCreativePhotoDataMediaElements.java index 635b6721..909fc061 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativePhotoDataMediaElements.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativePhotoDataMediaElements.java @@ -60,9 +60,8 @@ public String getId() { public static AdCreativePhotoDataMediaElements loadJSON(String json, APIContext context, String header) { AdCreativePhotoDataMediaElements adCreativePhotoDataMediaElements = getGson().fromJson(json, AdCreativePhotoDataMediaElements.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativePhotoDataMediaElements.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativePhotoDataMediaElements.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String APINodeList adCreativePhotoDataMediaElementss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativePlaceData.java b/src/main/java/com/facebook/ads/sdk/AdCreativePlaceData.java index e0575d03..566b415e 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativePlaceData.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativePlaceData.java @@ -64,9 +64,8 @@ public String getId() { public static AdCreativePlaceData loadJSON(String json, APIContext context, String header) { AdCreativePlaceData adCreativePlaceData = getGson().fromJson(json, AdCreativePlaceData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativePlaceData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativePlaceData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList adCreativePlaceDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativePlatformCustomization.java b/src/main/java/com/facebook/ads/sdk/AdCreativePlatformCustomization.java index b5a330fb..cfe5161f 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativePlatformCustomization.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativePlatformCustomization.java @@ -54,9 +54,8 @@ public String getId() { public static AdCreativePlatformCustomization loadJSON(String json, APIContext context, String header) { AdCreativePlatformCustomization adCreativePlatformCustomization = getGson().fromJson(json, AdCreativePlatformCustomization.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativePlatformCustomization.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativePlatformCustomization.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String APINodeList adCreativePlatformCustomizations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativePortraitCustomizations.java b/src/main/java/com/facebook/ads/sdk/AdCreativePortraitCustomizations.java index 94996d7a..1bd36fea 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativePortraitCustomizations.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativePortraitCustomizations.java @@ -56,9 +56,8 @@ public String getId() { public static AdCreativePortraitCustomizations loadJSON(String json, APIContext context, String header) { AdCreativePortraitCustomizations adCreativePortraitCustomizations = getGson().fromJson(json, AdCreativePortraitCustomizations.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativePortraitCustomizations.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativePortraitCustomizations.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String APINodeList adCreativePortraitCustomizationss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativePostClickConfiguration.java b/src/main/java/com/facebook/ads/sdk/AdCreativePostClickConfiguration.java index 9cb16fa2..93fe9048 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativePostClickConfiguration.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativePostClickConfiguration.java @@ -56,9 +56,8 @@ public String getId() { public static AdCreativePostClickConfiguration loadJSON(String json, APIContext context, String header) { AdCreativePostClickConfiguration adCreativePostClickConfiguration = getGson().fromJson(json, AdCreativePostClickConfiguration.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativePostClickConfiguration.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativePostClickConfiguration.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String APINodeList adCreativePostClickConfigurations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeProductData.java b/src/main/java/com/facebook/ads/sdk/AdCreativeProductData.java index e7f3f343..1060e155 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeProductData.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeProductData.java @@ -56,9 +56,8 @@ public String getId() { public static AdCreativeProductData loadJSON(String json, APIContext context, String header) { AdCreativeProductData adCreativeProductData = getGson().fromJson(json, AdCreativeProductData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeProductData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeProductData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList adCreativeProductDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativePromotionMetadataSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativePromotionMetadataSpec.java index bc171901..8d440123 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativePromotionMetadataSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativePromotionMetadataSpec.java @@ -66,9 +66,8 @@ public String getId() { public static AdCreativePromotionMetadataSpec loadJSON(String json, APIContext context, String header) { AdCreativePromotionMetadataSpec adCreativePromotionMetadataSpec = getGson().fromJson(json, AdCreativePromotionMetadataSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativePromotionMetadataSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativePromotionMetadataSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String APINodeList adCreativePromotionMetadataSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeRecommenderSettings.java b/src/main/java/com/facebook/ads/sdk/AdCreativeRecommenderSettings.java index e1db080f..6509c9b8 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeRecommenderSettings.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeRecommenderSettings.java @@ -56,9 +56,8 @@ public String getId() { public static AdCreativeRecommenderSettings loadJSON(String json, APIContext context, String header) { AdCreativeRecommenderSettings adCreativeRecommenderSettings = getGson().fromJson(json, AdCreativeRecommenderSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeRecommenderSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeRecommenderSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String js APINodeList adCreativeRecommenderSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeRegionalRegulationDisclaimer.java b/src/main/java/com/facebook/ads/sdk/AdCreativeRegionalRegulationDisclaimer.java index 19729395..abb5656a 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeRegionalRegulationDisclaimer.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeRegionalRegulationDisclaimer.java @@ -52,9 +52,8 @@ public String getId() { public static AdCreativeRegionalRegulationDisclaimer loadJSON(String json, APIContext context, String header) { AdCreativeRegionalRegulationDisclaimer adCreativeRegionalRegulationDisclaimer = getGson().fromJson(json, AdCreativeRegionalRegulationDisclaimer.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeRegionalRegulationDisclaimer.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeRegionalRegulationDisclaimer.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseResponse( APINodeList adCreativeRegionalRegulationDisclaimers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeRewardInfo.java b/src/main/java/com/facebook/ads/sdk/AdCreativeRewardInfo.java index 3835c41d..b3f63629 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeRewardInfo.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeRewardInfo.java @@ -56,9 +56,8 @@ public String getId() { public static AdCreativeRewardInfo loadJSON(String json, APIContext context, String header) { AdCreativeRewardInfo adCreativeRewardInfo = getGson().fromJson(json, AdCreativeRewardInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeRewardInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeRewardInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList adCreativeRewardInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeShopSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeShopSpec.java index d0a752c0..eb348dcd 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeShopSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeShopSpec.java @@ -58,9 +58,8 @@ public String getId() { public static AdCreativeShopSpec loadJSON(String json, APIContext context, String header) { AdCreativeShopSpec adCreativeShopSpec = getGson().fromJson(json, AdCreativeShopSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeShopSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeShopSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList adCreativeShopSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeSiteLinksSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeSiteLinksSpec.java index ec2ff447..9c53b0d2 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeSiteLinksSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeSiteLinksSpec.java @@ -62,9 +62,8 @@ public String getId() { public static AdCreativeSiteLinksSpec loadJSON(String json, APIContext context, String header) { AdCreativeSiteLinksSpec adCreativeSiteLinksSpec = getGson().fromJson(json, AdCreativeSiteLinksSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeSiteLinksSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeSiteLinksSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, AP APINodeList adCreativeSiteLinksSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeSourcingSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeSourcingSpec.java index 1184b8f3..65a33d74 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeSourcingSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeSourcingSpec.java @@ -62,9 +62,8 @@ public String getId() { public static AdCreativeSourcingSpec loadJSON(String json, APIContext context, String header) { AdCreativeSourcingSpec adCreativeSourcingSpec = getGson().fromJson(json, AdCreativeSourcingSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeSourcingSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeSourcingSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, API APINodeList adCreativeSourcingSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeStaticFallbackSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeStaticFallbackSpec.java index 0a98f7f2..59957a65 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeStaticFallbackSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeStaticFallbackSpec.java @@ -64,9 +64,8 @@ public String getId() { public static AdCreativeStaticFallbackSpec loadJSON(String json, APIContext context, String header) { AdCreativeStaticFallbackSpec adCreativeStaticFallbackSpec = getGson().fromJson(json, AdCreativeStaticFallbackSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeStaticFallbackSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeStaticFallbackSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String jso APINodeList adCreativeStaticFallbackSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeTemplateURLSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeTemplateURLSpec.java index 938f65af..085413aa 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeTemplateURLSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeTemplateURLSpec.java @@ -66,9 +66,8 @@ public String getId() { public static AdCreativeTemplateURLSpec loadJSON(String json, APIContext context, String header) { AdCreativeTemplateURLSpec adCreativeTemplateURLSpec = getGson().fromJson(json, AdCreativeTemplateURLSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeTemplateURLSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeTemplateURLSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, APINodeList adCreativeTemplateURLSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeTextData.java b/src/main/java/com/facebook/ads/sdk/AdCreativeTextData.java index bdc9edd1..463d6608 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeTextData.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeTextData.java @@ -54,9 +54,8 @@ public String getId() { public static AdCreativeTextData loadJSON(String json, APIContext context, String header) { AdCreativeTextData adCreativeTextData = getGson().fromJson(json, AdCreativeTextData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeTextData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeTextData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList adCreativeTextDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeVideoData.java b/src/main/java/com/facebook/ads/sdk/AdCreativeVideoData.java index e370f8f8..6b25453e 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeVideoData.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeVideoData.java @@ -86,9 +86,8 @@ public String getId() { public static AdCreativeVideoData loadJSON(String json, APIContext context, String header) { AdCreativeVideoData adCreativeVideoData = getGson().fromJson(json, AdCreativeVideoData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeVideoData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeVideoData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -108,10 +107,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList adCreativeVideoDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeVideoDataCustomOverlaySpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeVideoDataCustomOverlaySpec.java index 4381300d..48eda075 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeVideoDataCustomOverlaySpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeVideoDataCustomOverlaySpec.java @@ -72,9 +72,8 @@ public String getId() { public static AdCreativeVideoDataCustomOverlaySpec loadJSON(String json, APIContext context, String header) { AdCreativeVideoDataCustomOverlaySpec adCreativeVideoDataCustomOverlaySpec = getGson().fromJson(json, AdCreativeVideoDataCustomOverlaySpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeVideoDataCustomOverlaySpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeVideoDataCustomOverlaySpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -94,10 +93,9 @@ public static APINodeList parseResponse(St APINodeList adCreativeVideoDataCustomOverlaySpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeVideoDataMediaElements.java b/src/main/java/com/facebook/ads/sdk/AdCreativeVideoDataMediaElements.java index 02e8a2f8..a78e1089 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeVideoDataMediaElements.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeVideoDataMediaElements.java @@ -56,9 +56,8 @@ public String getId() { public static AdCreativeVideoDataMediaElements loadJSON(String json, APIContext context, String header) { AdCreativeVideoDataMediaElements adCreativeVideoDataMediaElements = getGson().fromJson(json, AdCreativeVideoDataMediaElements.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeVideoDataMediaElements.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeVideoDataMediaElements.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String APINodeList adCreativeVideoDataMediaElementss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCreativeWhatsAppChannelSpec.java b/src/main/java/com/facebook/ads/sdk/AdCreativeWhatsAppChannelSpec.java index 89285396..c3c80687 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCreativeWhatsAppChannelSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCreativeWhatsAppChannelSpec.java @@ -56,9 +56,8 @@ public String getId() { public static AdCreativeWhatsAppChannelSpec loadJSON(String json, APIContext context, String header) { AdCreativeWhatsAppChannelSpec adCreativeWhatsAppChannelSpec = getGson().fromJson(json, AdCreativeWhatsAppChannelSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCreativeWhatsAppChannelSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCreativeWhatsAppChannelSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String js APINodeList adCreativeWhatsAppChannelSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCustomDerivedMetrics.java b/src/main/java/com/facebook/ads/sdk/AdCustomDerivedMetrics.java index 8b0cf91c..d9956cbe 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCustomDerivedMetrics.java +++ b/src/main/java/com/facebook/ads/sdk/AdCustomDerivedMetrics.java @@ -145,9 +145,8 @@ public String getId() { public static AdCustomDerivedMetrics loadJSON(String json, APIContext context, String header) { AdCustomDerivedMetrics adCustomDerivedMetrics = getGson().fromJson(json, AdCustomDerivedMetrics.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCustomDerivedMetrics.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCustomDerivedMetrics.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -167,10 +166,9 @@ public static APINodeList parseResponse(String json, API APINodeList adCustomDerivedMetricss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdCustomizationRuleSpec.java b/src/main/java/com/facebook/ads/sdk/AdCustomizationRuleSpec.java index 879ca37a..565a5a6b 100644 --- a/src/main/java/com/facebook/ads/sdk/AdCustomizationRuleSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdCustomizationRuleSpec.java @@ -72,9 +72,8 @@ public String getId() { public static AdCustomizationRuleSpec loadJSON(String json, APIContext context, String header) { AdCustomizationRuleSpec adCustomizationRuleSpec = getGson().fromJson(json, AdCustomizationRuleSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adCustomizationRuleSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adCustomizationRuleSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -94,10 +93,9 @@ public static APINodeList parseResponse(String json, AP APINodeList adCustomizationRuleSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdDefaultValues.java b/src/main/java/com/facebook/ads/sdk/AdDefaultValues.java index 1cf26256..bf8ef44d 100644 --- a/src/main/java/com/facebook/ads/sdk/AdDefaultValues.java +++ b/src/main/java/com/facebook/ads/sdk/AdDefaultValues.java @@ -54,9 +54,8 @@ public String getId() { public static AdDefaultValues loadJSON(String json, APIContext context, String header) { AdDefaultValues adDefaultValues = getGson().fromJson(json, AdDefaultValues.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adDefaultValues.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adDefaultValues.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adDefaultValuess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdDraft.java b/src/main/java/com/facebook/ads/sdk/AdDraft.java index 5f2b6c90..c1a362d8 100644 --- a/src/main/java/com/facebook/ads/sdk/AdDraft.java +++ b/src/main/java/com/facebook/ads/sdk/AdDraft.java @@ -141,9 +141,8 @@ public String getId() { public static AdDraft loadJSON(String json, APIContext context, String header) { AdDraft adDraft = getGson().fromJson(json, AdDraft.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adDraft.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adDraft.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -163,10 +162,9 @@ public static APINodeList parseResponse(String json, APIContext context APINodeList adDrafts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdDynamicCreative.java b/src/main/java/com/facebook/ads/sdk/AdDynamicCreative.java index e93b124d..1fa5447c 100644 --- a/src/main/java/com/facebook/ads/sdk/AdDynamicCreative.java +++ b/src/main/java/com/facebook/ads/sdk/AdDynamicCreative.java @@ -54,9 +54,8 @@ public String getId() { public static AdDynamicCreative loadJSON(String json, APIContext context, String header) { AdDynamicCreative adDynamicCreative = getGson().fromJson(json, AdDynamicCreative.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adDynamicCreative.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adDynamicCreative.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList adDynamicCreatives = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdEntityTargetSpend.java b/src/main/java/com/facebook/ads/sdk/AdEntityTargetSpend.java index cda08482..4ce9f1f4 100644 --- a/src/main/java/com/facebook/ads/sdk/AdEntityTargetSpend.java +++ b/src/main/java/com/facebook/ads/sdk/AdEntityTargetSpend.java @@ -62,9 +62,8 @@ public String getId() { public static AdEntityTargetSpend loadJSON(String json, APIContext context, String header) { AdEntityTargetSpend adEntityTargetSpend = getGson().fromJson(json, AdEntityTargetSpend.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adEntityTargetSpend.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adEntityTargetSpend.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList adEntityTargetSpends = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdExportPreset.java b/src/main/java/com/facebook/ads/sdk/AdExportPreset.java index 357d2483..b631ce3e 100644 --- a/src/main/java/com/facebook/ads/sdk/AdExportPreset.java +++ b/src/main/java/com/facebook/ads/sdk/AdExportPreset.java @@ -123,9 +123,8 @@ public String getId() { public static AdExportPreset loadJSON(String json, APIContext context, String header) { AdExportPreset adExportPreset = getGson().fromJson(json, AdExportPreset.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adExportPreset.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adExportPreset.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adExportPresets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdImage.java b/src/main/java/com/facebook/ads/sdk/AdImage.java index 09b390a8..b8bc253a 100644 --- a/src/main/java/com/facebook/ads/sdk/AdImage.java +++ b/src/main/java/com/facebook/ads/sdk/AdImage.java @@ -145,9 +145,8 @@ public String getId() { public static AdImage loadJSON(String json, APIContext context, String header) { AdImage adImage = getGson().fromJson(json, AdImage.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adImage.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adImage.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -167,10 +166,9 @@ public static APINodeList parseResponse(String json, APIContext context APINodeList adImages = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdKeywordStats.java b/src/main/java/com/facebook/ads/sdk/AdKeywordStats.java index 955ee76c..655f951b 100644 --- a/src/main/java/com/facebook/ads/sdk/AdKeywordStats.java +++ b/src/main/java/com/facebook/ads/sdk/AdKeywordStats.java @@ -92,9 +92,8 @@ public String getId() { public static AdKeywordStats loadJSON(String json, APIContext context, String header) { AdKeywordStats adKeywordStats = getGson().fromJson(json, AdKeywordStats.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adKeywordStats.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adKeywordStats.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -114,10 +113,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adKeywordStatss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdKeywords.java b/src/main/java/com/facebook/ads/sdk/AdKeywords.java index cdfa8040..b3837572 100644 --- a/src/main/java/com/facebook/ads/sdk/AdKeywords.java +++ b/src/main/java/com/facebook/ads/sdk/AdKeywords.java @@ -60,9 +60,8 @@ public String getId() { public static AdKeywords loadJSON(String json, APIContext context, String header) { AdKeywords adKeywords = getGson().fromJson(json, AdKeywords.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adKeywords.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adKeywords.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList adKeywordss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdKpiShift.java b/src/main/java/com/facebook/ads/sdk/AdKpiShift.java index 5a3b60ba..ae083ce4 100644 --- a/src/main/java/com/facebook/ads/sdk/AdKpiShift.java +++ b/src/main/java/com/facebook/ads/sdk/AdKpiShift.java @@ -64,9 +64,8 @@ public String getId() { public static AdKpiShift loadJSON(String json, APIContext context, String header) { AdKpiShift adKpiShift = getGson().fromJson(json, AdKpiShift.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adKpiShift.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adKpiShift.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList adKpiShifts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdLabel.java b/src/main/java/com/facebook/ads/sdk/AdLabel.java index 221e9387..0826d56d 100644 --- a/src/main/java/com/facebook/ads/sdk/AdLabel.java +++ b/src/main/java/com/facebook/ads/sdk/AdLabel.java @@ -121,9 +121,8 @@ public String getId() { public static AdLabel loadJSON(String json, APIContext context, String header) { AdLabel adLabel = getGson().fromJson(json, AdLabel.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adLabel.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adLabel.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String json, APIContext context APINodeList adLabels = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdLightAdgroup.java b/src/main/java/com/facebook/ads/sdk/AdLightAdgroup.java index 6df99f6a..19ebfde9 100644 --- a/src/main/java/com/facebook/ads/sdk/AdLightAdgroup.java +++ b/src/main/java/com/facebook/ads/sdk/AdLightAdgroup.java @@ -115,9 +115,8 @@ public String getId() { public static AdLightAdgroup loadJSON(String json, APIContext context, String header) { AdLightAdgroup adLightAdgroup = getGson().fromJson(json, AdLightAdgroup.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adLightAdgroup.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adLightAdgroup.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adLightAdgroups = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdLightCampaign.java b/src/main/java/com/facebook/ads/sdk/AdLightCampaign.java index d14b8950..c3a2a4fd 100644 --- a/src/main/java/com/facebook/ads/sdk/AdLightCampaign.java +++ b/src/main/java/com/facebook/ads/sdk/AdLightCampaign.java @@ -115,9 +115,8 @@ public String getId() { public static AdLightCampaign loadJSON(String json, APIContext context, String header) { AdLightCampaign adLightCampaign = getGson().fromJson(json, AdLightCampaign.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adLightCampaign.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adLightCampaign.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adLightCampaigns = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdLightCampaignGroup.java b/src/main/java/com/facebook/ads/sdk/AdLightCampaignGroup.java index 706dedca..94c7f5a8 100644 --- a/src/main/java/com/facebook/ads/sdk/AdLightCampaignGroup.java +++ b/src/main/java/com/facebook/ads/sdk/AdLightCampaignGroup.java @@ -113,9 +113,8 @@ public String getId() { public static AdLightCampaignGroup loadJSON(String json, APIContext context, String header) { AdLightCampaignGroup adLightCampaignGroup = getGson().fromJson(json, AdLightCampaignGroup.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adLightCampaignGroup.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adLightCampaignGroup.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -135,10 +134,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList adLightCampaignGroups = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdLimitSetting.java b/src/main/java/com/facebook/ads/sdk/AdLimitSetting.java index 934c4eff..b4677ce4 100644 --- a/src/main/java/com/facebook/ads/sdk/AdLimitSetting.java +++ b/src/main/java/com/facebook/ads/sdk/AdLimitSetting.java @@ -54,9 +54,8 @@ public String getId() { public static AdLimitSetting loadJSON(String json, APIContext context, String header) { AdLimitSetting adLimitSetting = getGson().fromJson(json, AdLimitSetting.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adLimitSetting.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adLimitSetting.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adLimitSettings = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdLimitsEnforcementData.java b/src/main/java/com/facebook/ads/sdk/AdLimitsEnforcementData.java index 0a6da8fa..a65b637b 100644 --- a/src/main/java/com/facebook/ads/sdk/AdLimitsEnforcementData.java +++ b/src/main/java/com/facebook/ads/sdk/AdLimitsEnforcementData.java @@ -64,9 +64,8 @@ public String getId() { public static AdLimitsEnforcementData loadJSON(String json, APIContext context, String header) { AdLimitsEnforcementData adLimitsEnforcementData = getGson().fromJson(json, AdLimitsEnforcementData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adLimitsEnforcementData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adLimitsEnforcementData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, AP APINodeList adLimitsEnforcementDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdMonetizationProperty.java b/src/main/java/com/facebook/ads/sdk/AdMonetizationProperty.java index 48a06e0d..226536d6 100644 --- a/src/main/java/com/facebook/ads/sdk/AdMonetizationProperty.java +++ b/src/main/java/com/facebook/ads/sdk/AdMonetizationProperty.java @@ -115,9 +115,8 @@ public String getId() { public static AdMonetizationProperty loadJSON(String json, APIContext context, String header) { AdMonetizationProperty adMonetizationProperty = getGson().fromJson(json, AdMonetizationProperty.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adMonetizationProperty.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adMonetizationProperty.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, API APINodeList adMonetizationPropertys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdNetworkAnalyticsAsyncQueryExport.java b/src/main/java/com/facebook/ads/sdk/AdNetworkAnalyticsAsyncQueryExport.java index 4af13328..816e2d9e 100644 --- a/src/main/java/com/facebook/ads/sdk/AdNetworkAnalyticsAsyncQueryExport.java +++ b/src/main/java/com/facebook/ads/sdk/AdNetworkAnalyticsAsyncQueryExport.java @@ -60,9 +60,8 @@ public String getId() { public static AdNetworkAnalyticsAsyncQueryExport loadJSON(String json, APIContext context, String header) { AdNetworkAnalyticsAsyncQueryExport adNetworkAnalyticsAsyncQueryExport = getGson().fromJson(json, AdNetworkAnalyticsAsyncQueryExport.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adNetworkAnalyticsAsyncQueryExport.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adNetworkAnalyticsAsyncQueryExport.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(Stri APINodeList adNetworkAnalyticsAsyncQueryExports = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdNetworkAnalyticsAsyncQueryResult.java b/src/main/java/com/facebook/ads/sdk/AdNetworkAnalyticsAsyncQueryResult.java index a294f27c..609d1ee7 100644 --- a/src/main/java/com/facebook/ads/sdk/AdNetworkAnalyticsAsyncQueryResult.java +++ b/src/main/java/com/facebook/ads/sdk/AdNetworkAnalyticsAsyncQueryResult.java @@ -64,9 +64,8 @@ public String getId() { public static AdNetworkAnalyticsAsyncQueryResult loadJSON(String json, APIContext context, String header) { AdNetworkAnalyticsAsyncQueryResult adNetworkAnalyticsAsyncQueryResult = getGson().fromJson(json, AdNetworkAnalyticsAsyncQueryResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adNetworkAnalyticsAsyncQueryResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adNetworkAnalyticsAsyncQueryResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(Stri APINodeList adNetworkAnalyticsAsyncQueryResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdNetworkAnalyticsSyncQueryResult.java b/src/main/java/com/facebook/ads/sdk/AdNetworkAnalyticsSyncQueryResult.java index 70274d7c..76885b10 100644 --- a/src/main/java/com/facebook/ads/sdk/AdNetworkAnalyticsSyncQueryResult.java +++ b/src/main/java/com/facebook/ads/sdk/AdNetworkAnalyticsSyncQueryResult.java @@ -58,9 +58,8 @@ public String getId() { public static AdNetworkAnalyticsSyncQueryResult loadJSON(String json, APIContext context, String header) { AdNetworkAnalyticsSyncQueryResult adNetworkAnalyticsSyncQueryResult = getGson().fromJson(json, AdNetworkAnalyticsSyncQueryResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adNetworkAnalyticsSyncQueryResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adNetworkAnalyticsSyncQueryResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(Strin APINodeList adNetworkAnalyticsSyncQueryResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdPlacePageSet.java b/src/main/java/com/facebook/ads/sdk/AdPlacePageSet.java index 359c8a74..ba24719b 100644 --- a/src/main/java/com/facebook/ads/sdk/AdPlacePageSet.java +++ b/src/main/java/com/facebook/ads/sdk/AdPlacePageSet.java @@ -123,9 +123,8 @@ public String getId() { public static AdPlacePageSet loadJSON(String json, APIContext context, String header) { AdPlacePageSet adPlacePageSet = getGson().fromJson(json, AdPlacePageSet.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adPlacePageSet.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adPlacePageSet.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adPlacePageSets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdPlacePageSetMetadata.java b/src/main/java/com/facebook/ads/sdk/AdPlacePageSetMetadata.java index 7eabecb6..55a7bc03 100644 --- a/src/main/java/com/facebook/ads/sdk/AdPlacePageSetMetadata.java +++ b/src/main/java/com/facebook/ads/sdk/AdPlacePageSetMetadata.java @@ -60,9 +60,8 @@ public String getId() { public static AdPlacePageSetMetadata loadJSON(String json, APIContext context, String header) { AdPlacePageSetMetadata adPlacePageSetMetadata = getGson().fromJson(json, AdPlacePageSetMetadata.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adPlacePageSetMetadata.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adPlacePageSetMetadata.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, API APINodeList adPlacePageSetMetadatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdPlacement.java b/src/main/java/com/facebook/ads/sdk/AdPlacement.java index 1d1cccd0..ee7e4a66 100644 --- a/src/main/java/com/facebook/ads/sdk/AdPlacement.java +++ b/src/main/java/com/facebook/ads/sdk/AdPlacement.java @@ -129,9 +129,8 @@ public String getId() { public static AdPlacement loadJSON(String json, APIContext context, String header) { AdPlacement adPlacement = getGson().fromJson(json, AdPlacement.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adPlacement.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adPlacement.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList adPlacements = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdPreview.java b/src/main/java/com/facebook/ads/sdk/AdPreview.java index 48f6f570..ad8f7f7c 100644 --- a/src/main/java/com/facebook/ads/sdk/AdPreview.java +++ b/src/main/java/com/facebook/ads/sdk/AdPreview.java @@ -56,9 +56,8 @@ public String getId() { public static AdPreview loadJSON(String json, APIContext context, String header) { AdPreview adPreview = getGson().fromJson(json, AdPreview.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adPreview.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adPreview.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext conte APINodeList adPreviews = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdPromotedObject.java b/src/main/java/com/facebook/ads/sdk/AdPromotedObject.java index 6eba800d..ebe28a55 100644 --- a/src/main/java/com/facebook/ads/sdk/AdPromotedObject.java +++ b/src/main/java/com/facebook/ads/sdk/AdPromotedObject.java @@ -110,9 +110,8 @@ public String getId() { public static AdPromotedObject loadJSON(String json, APIContext context, String header) { AdPromotedObject adPromotedObject = getGson().fromJson(json, AdPromotedObject.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adPromotedObject.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adPromotedObject.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -132,10 +131,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList adPromotedObjects = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdProposal.java b/src/main/java/com/facebook/ads/sdk/AdProposal.java index 29f9a6d3..4cbb63fb 100644 --- a/src/main/java/com/facebook/ads/sdk/AdProposal.java +++ b/src/main/java/com/facebook/ads/sdk/AdProposal.java @@ -149,9 +149,8 @@ public String getId() { public static AdProposal loadJSON(String json, APIContext context, String header) { AdProposal adProposal = getGson().fromJson(json, AdProposal.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adProposal.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adProposal.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -171,10 +170,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList adProposals = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdRecommendation.java b/src/main/java/com/facebook/ads/sdk/AdRecommendation.java index 423f78b1..352e2343 100644 --- a/src/main/java/com/facebook/ads/sdk/AdRecommendation.java +++ b/src/main/java/com/facebook/ads/sdk/AdRecommendation.java @@ -68,9 +68,8 @@ public String getId() { public static AdRecommendation loadJSON(String json, APIContext context, String header) { AdRecommendation adRecommendation = getGson().fromJson(json, AdRecommendation.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adRecommendation.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adRecommendation.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList adRecommendations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdRecommendationData.java b/src/main/java/com/facebook/ads/sdk/AdRecommendationData.java index 8d6d1200..f7b7c71c 100644 --- a/src/main/java/com/facebook/ads/sdk/AdRecommendationData.java +++ b/src/main/java/com/facebook/ads/sdk/AdRecommendationData.java @@ -54,9 +54,8 @@ public String getId() { public static AdRecommendationData loadJSON(String json, APIContext context, String header) { AdRecommendationData adRecommendationData = getGson().fromJson(json, AdRecommendationData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adRecommendationData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adRecommendationData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList adRecommendationDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdReportRun.java b/src/main/java/com/facebook/ads/sdk/AdReportRun.java index ffc0da6c..fb28ae2d 100644 --- a/src/main/java/com/facebook/ads/sdk/AdReportRun.java +++ b/src/main/java/com/facebook/ads/sdk/AdReportRun.java @@ -137,9 +137,8 @@ public String getId() { public static AdReportRun loadJSON(String json, APIContext context, String header) { AdReportRun adReportRun = getGson().fromJson(json, AdReportRun.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adReportRun.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adReportRun.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -152,8 +151,7 @@ public static AdReportRun loadJSON(String json, APIContext context, String heade adReportRun.context = context; adReportRun.rawValue = json; adReportRun.header = header; - JsonParser parser = new JsonParser(); - JsonObject o = parser.parse(json).getAsJsonObject(); + JsonObject o = JsonParser.parseString(json).getAsJsonObject(); String reportRunId = null; if (o.has("report_run_id")) { reportRunId = o.get("report_run_id").getAsString(); @@ -168,10 +166,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList adReportRuns = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdRule.java b/src/main/java/com/facebook/ads/sdk/AdRule.java index 62dd6168..cf1aeae7 100644 --- a/src/main/java/com/facebook/ads/sdk/AdRule.java +++ b/src/main/java/com/facebook/ads/sdk/AdRule.java @@ -133,9 +133,8 @@ public String getId() { public static AdRule loadJSON(String json, APIContext context, String header) { AdRule adRule = getGson().fromJson(json, AdRule.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adRule.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adRule.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -155,10 +154,9 @@ public static APINodeList parseResponse(String json, APIContext context, APINodeList adRules = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdRuleEvaluationSpec.java b/src/main/java/com/facebook/ads/sdk/AdRuleEvaluationSpec.java index b72464e8..b907c76e 100644 --- a/src/main/java/com/facebook/ads/sdk/AdRuleEvaluationSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdRuleEvaluationSpec.java @@ -119,9 +119,8 @@ public String getId() { public static AdRuleEvaluationSpec loadJSON(String json, APIContext context, String header) { AdRuleEvaluationSpec adRuleEvaluationSpec = getGson().fromJson(json, AdRuleEvaluationSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adRuleEvaluationSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adRuleEvaluationSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList adRuleEvaluationSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdRuleExecutionOptions.java b/src/main/java/com/facebook/ads/sdk/AdRuleExecutionOptions.java index 9f64a3cc..e81de07b 100644 --- a/src/main/java/com/facebook/ads/sdk/AdRuleExecutionOptions.java +++ b/src/main/java/com/facebook/ads/sdk/AdRuleExecutionOptions.java @@ -58,9 +58,8 @@ public String getId() { public static AdRuleExecutionOptions loadJSON(String json, APIContext context, String header) { AdRuleExecutionOptions adRuleExecutionOptions = getGson().fromJson(json, AdRuleExecutionOptions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adRuleExecutionOptions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adRuleExecutionOptions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, API APINodeList adRuleExecutionOptionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdRuleExecutionSpec.java b/src/main/java/com/facebook/ads/sdk/AdRuleExecutionSpec.java index 6ccfc3ca..b837170f 100644 --- a/src/main/java/com/facebook/ads/sdk/AdRuleExecutionSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdRuleExecutionSpec.java @@ -117,9 +117,8 @@ public String getId() { public static AdRuleExecutionSpec loadJSON(String json, APIContext context, String header) { AdRuleExecutionSpec adRuleExecutionSpec = getGson().fromJson(json, AdRuleExecutionSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adRuleExecutionSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adRuleExecutionSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList adRuleExecutionSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdRuleFilters.java b/src/main/java/com/facebook/ads/sdk/AdRuleFilters.java index ad77ac8c..c40b5f90 100644 --- a/src/main/java/com/facebook/ads/sdk/AdRuleFilters.java +++ b/src/main/java/com/facebook/ads/sdk/AdRuleFilters.java @@ -58,9 +58,8 @@ public String getId() { public static AdRuleFilters loadJSON(String json, APIContext context, String header) { AdRuleFilters adRuleFilters = getGson().fromJson(json, AdRuleFilters.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adRuleFilters.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adRuleFilters.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList adRuleFilterss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdRuleHistory.java b/src/main/java/com/facebook/ads/sdk/AdRuleHistory.java index 2936729c..76a0c2c1 100644 --- a/src/main/java/com/facebook/ads/sdk/AdRuleHistory.java +++ b/src/main/java/com/facebook/ads/sdk/AdRuleHistory.java @@ -68,9 +68,8 @@ public String getId() { public static AdRuleHistory loadJSON(String json, APIContext context, String header) { AdRuleHistory adRuleHistory = getGson().fromJson(json, AdRuleHistory.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adRuleHistory.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adRuleHistory.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList adRuleHistorys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdRuleHistoryResult.java b/src/main/java/com/facebook/ads/sdk/AdRuleHistoryResult.java index 14f3cb22..55b75060 100644 --- a/src/main/java/com/facebook/ads/sdk/AdRuleHistoryResult.java +++ b/src/main/java/com/facebook/ads/sdk/AdRuleHistoryResult.java @@ -58,9 +58,8 @@ public String getId() { public static AdRuleHistoryResult loadJSON(String json, APIContext context, String header) { AdRuleHistoryResult adRuleHistoryResult = getGson().fromJson(json, AdRuleHistoryResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adRuleHistoryResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adRuleHistoryResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList adRuleHistoryResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdRuleHistoryResultAction.java b/src/main/java/com/facebook/ads/sdk/AdRuleHistoryResultAction.java index baa7e541..f14e84ef 100644 --- a/src/main/java/com/facebook/ads/sdk/AdRuleHistoryResultAction.java +++ b/src/main/java/com/facebook/ads/sdk/AdRuleHistoryResultAction.java @@ -60,9 +60,8 @@ public String getId() { public static AdRuleHistoryResultAction loadJSON(String json, APIContext context, String header) { AdRuleHistoryResultAction adRuleHistoryResultAction = getGson().fromJson(json, AdRuleHistoryResultAction.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adRuleHistoryResultAction.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adRuleHistoryResultAction.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APINodeList adRuleHistoryResultActions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdRuleSchedule.java b/src/main/java/com/facebook/ads/sdk/AdRuleSchedule.java index af709608..a81324ad 100644 --- a/src/main/java/com/facebook/ads/sdk/AdRuleSchedule.java +++ b/src/main/java/com/facebook/ads/sdk/AdRuleSchedule.java @@ -58,9 +58,8 @@ public String getId() { public static AdRuleSchedule loadJSON(String json, APIContext context, String header) { AdRuleSchedule adRuleSchedule = getGson().fromJson(json, AdRuleSchedule.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adRuleSchedule.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adRuleSchedule.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adRuleSchedules = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdRuleScheduleSpec.java b/src/main/java/com/facebook/ads/sdk/AdRuleScheduleSpec.java index c804a3af..93f9221c 100644 --- a/src/main/java/com/facebook/ads/sdk/AdRuleScheduleSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AdRuleScheduleSpec.java @@ -56,9 +56,8 @@ public String getId() { public static AdRuleScheduleSpec loadJSON(String json, APIContext context, String header) { AdRuleScheduleSpec adRuleScheduleSpec = getGson().fromJson(json, AdRuleScheduleSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adRuleScheduleSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adRuleScheduleSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList adRuleScheduleSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdRuleTrigger.java b/src/main/java/com/facebook/ads/sdk/AdRuleTrigger.java index 922b76ec..5902d251 100644 --- a/src/main/java/com/facebook/ads/sdk/AdRuleTrigger.java +++ b/src/main/java/com/facebook/ads/sdk/AdRuleTrigger.java @@ -60,9 +60,8 @@ public String getId() { public static AdRuleTrigger loadJSON(String json, APIContext context, String header) { AdRuleTrigger adRuleTrigger = getGson().fromJson(json, AdRuleTrigger.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adRuleTrigger.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adRuleTrigger.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList adRuleTriggers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdSavedKeywords.java b/src/main/java/com/facebook/ads/sdk/AdSavedKeywords.java index 50dda20e..e2eb4ceb 100644 --- a/src/main/java/com/facebook/ads/sdk/AdSavedKeywords.java +++ b/src/main/java/com/facebook/ads/sdk/AdSavedKeywords.java @@ -125,9 +125,8 @@ public String getId() { public static AdSavedKeywords loadJSON(String json, APIContext context, String header) { AdSavedKeywords adSavedKeywords = getGson().fromJson(json, AdSavedKeywords.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adSavedKeywords.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adSavedKeywords.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adSavedKeywordss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdSavedLocation.java b/src/main/java/com/facebook/ads/sdk/AdSavedLocation.java index f496d733..81bb187a 100644 --- a/src/main/java/com/facebook/ads/sdk/AdSavedLocation.java +++ b/src/main/java/com/facebook/ads/sdk/AdSavedLocation.java @@ -131,9 +131,8 @@ public String getId() { public static AdSavedLocation loadJSON(String json, APIContext context, String header) { AdSavedLocation adSavedLocation = getGson().fromJson(json, AdSavedLocation.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adSavedLocation.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adSavedLocation.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -153,10 +152,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adSavedLocations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdSavedReport.java b/src/main/java/com/facebook/ads/sdk/AdSavedReport.java index 357ccd5b..9ccb1014 100644 --- a/src/main/java/com/facebook/ads/sdk/AdSavedReport.java +++ b/src/main/java/com/facebook/ads/sdk/AdSavedReport.java @@ -147,9 +147,8 @@ public String getId() { public static AdSavedReport loadJSON(String json, APIContext context, String header) { AdSavedReport adSavedReport = getGson().fromJson(json, AdSavedReport.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adSavedReport.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adSavedReport.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -169,10 +168,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList adSavedReports = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdSet.java b/src/main/java/com/facebook/ads/sdk/AdSet.java index 03e527ab..a2e3a7f9 100644 --- a/src/main/java/com/facebook/ads/sdk/AdSet.java +++ b/src/main/java/com/facebook/ads/sdk/AdSet.java @@ -241,9 +241,8 @@ public String getId() { public static AdSet loadJSON(String json, APIContext context, String header) { AdSet adSet = getGson().fromJson(json, AdSet.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adSet.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adSet.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -263,10 +262,9 @@ public static APINodeList parseResponse(String json, APIContext context, APINodeList adSets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdStudy.java b/src/main/java/com/facebook/ads/sdk/AdStudy.java index a848f012..2e0517fa 100644 --- a/src/main/java/com/facebook/ads/sdk/AdStudy.java +++ b/src/main/java/com/facebook/ads/sdk/AdStudy.java @@ -147,9 +147,8 @@ public String getId() { public static AdStudy loadJSON(String json, APIContext context, String header) { AdStudy adStudy = getGson().fromJson(json, AdStudy.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adStudy.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adStudy.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -169,10 +168,9 @@ public static APINodeList parseResponse(String json, APIContext context APINodeList adStudys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdStudyCell.java b/src/main/java/com/facebook/ads/sdk/AdStudyCell.java index f7ad03b0..e6e8949d 100644 --- a/src/main/java/com/facebook/ads/sdk/AdStudyCell.java +++ b/src/main/java/com/facebook/ads/sdk/AdStudyCell.java @@ -121,9 +121,8 @@ public String getId() { public static AdStudyCell loadJSON(String json, APIContext context, String header) { AdStudyCell adStudyCell = getGson().fromJson(json, AdStudyCell.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adStudyCell.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adStudyCell.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList adStudyCells = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdStudyObjective.java b/src/main/java/com/facebook/ads/sdk/AdStudyObjective.java index 17b1b2cc..15d197b0 100644 --- a/src/main/java/com/facebook/ads/sdk/AdStudyObjective.java +++ b/src/main/java/com/facebook/ads/sdk/AdStudyObjective.java @@ -123,9 +123,8 @@ public String getId() { public static AdStudyObjective loadJSON(String json, APIContext context, String header) { AdStudyObjective adStudyObjective = getGson().fromJson(json, AdStudyObjective.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adStudyObjective.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adStudyObjective.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList adStudyObjectives = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdStudyObjectiveID.java b/src/main/java/com/facebook/ads/sdk/AdStudyObjectiveID.java index 63fb24e8..b7c93329 100644 --- a/src/main/java/com/facebook/ads/sdk/AdStudyObjectiveID.java +++ b/src/main/java/com/facebook/ads/sdk/AdStudyObjectiveID.java @@ -58,9 +58,8 @@ public String getId() { public static AdStudyObjectiveID loadJSON(String json, APIContext context, String header) { AdStudyObjectiveID adStudyObjectiveID = getGson().fromJson(json, AdStudyObjectiveID.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adStudyObjectiveID.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adStudyObjectiveID.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList adStudyObjectiveIDs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdStudyObjectiveOffsiteDatasets.java b/src/main/java/com/facebook/ads/sdk/AdStudyObjectiveOffsiteDatasets.java index 3c71c62c..10a9fc29 100644 --- a/src/main/java/com/facebook/ads/sdk/AdStudyObjectiveOffsiteDatasets.java +++ b/src/main/java/com/facebook/ads/sdk/AdStudyObjectiveOffsiteDatasets.java @@ -56,9 +56,8 @@ public String getId() { public static AdStudyObjectiveOffsiteDatasets loadJSON(String json, APIContext context, String header) { AdStudyObjectiveOffsiteDatasets adStudyObjectiveOffsiteDatasets = getGson().fromJson(json, AdStudyObjectiveOffsiteDatasets.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adStudyObjectiveOffsiteDatasets.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adStudyObjectiveOffsiteDatasets.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String APINodeList adStudyObjectiveOffsiteDatasetss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdTopline.java b/src/main/java/com/facebook/ads/sdk/AdTopline.java index 3cee31b2..8155a089 100644 --- a/src/main/java/com/facebook/ads/sdk/AdTopline.java +++ b/src/main/java/com/facebook/ads/sdk/AdTopline.java @@ -181,9 +181,8 @@ public String getId() { public static AdTopline loadJSON(String json, APIContext context, String header) { AdTopline adTopline = getGson().fromJson(json, AdTopline.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adTopline.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adTopline.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -203,10 +202,9 @@ public static APINodeList parseResponse(String json, APIContext conte APINodeList adToplines = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdToplineDetail.java b/src/main/java/com/facebook/ads/sdk/AdToplineDetail.java index 194cba78..f83136ab 100644 --- a/src/main/java/com/facebook/ads/sdk/AdToplineDetail.java +++ b/src/main/java/com/facebook/ads/sdk/AdToplineDetail.java @@ -139,9 +139,8 @@ public String getId() { public static AdToplineDetail loadJSON(String json, APIContext context, String header) { AdToplineDetail adToplineDetail = getGson().fromJson(json, AdToplineDetail.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adToplineDetail.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adToplineDetail.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -161,10 +160,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adToplineDetails = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdVideo.java b/src/main/java/com/facebook/ads/sdk/AdVideo.java index 17b1fef2..db3dc459 100644 --- a/src/main/java/com/facebook/ads/sdk/AdVideo.java +++ b/src/main/java/com/facebook/ads/sdk/AdVideo.java @@ -203,9 +203,8 @@ public String getId() { public static AdVideo loadJSON(String json, APIContext context, String header) { AdVideo adVideo = getGson().fromJson(json, AdVideo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adVideo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adVideo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -225,10 +224,9 @@ public static APINodeList parseResponse(String json, APIContext context APINodeList adVideos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdVolume.java b/src/main/java/com/facebook/ads/sdk/AdVolume.java index 4ffabf1c..72934129 100644 --- a/src/main/java/com/facebook/ads/sdk/AdVolume.java +++ b/src/main/java/com/facebook/ads/sdk/AdVolume.java @@ -72,9 +72,8 @@ public String getId() { public static AdVolume loadJSON(String json, APIContext context, String header) { AdVolume adVolume = getGson().fromJson(json, AdVolume.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adVolume.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adVolume.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -94,10 +93,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList adVolumes = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdgroupFacebookFeedback.java b/src/main/java/com/facebook/ads/sdk/AdgroupFacebookFeedback.java index bdccbf05..91328f47 100644 --- a/src/main/java/com/facebook/ads/sdk/AdgroupFacebookFeedback.java +++ b/src/main/java/com/facebook/ads/sdk/AdgroupFacebookFeedback.java @@ -56,9 +56,8 @@ public String getId() { public static AdgroupFacebookFeedback loadJSON(String json, APIContext context, String header) { AdgroupFacebookFeedback adgroupFacebookFeedback = getGson().fromJson(json, AdgroupFacebookFeedback.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adgroupFacebookFeedback.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adgroupFacebookFeedback.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, AP APINodeList adgroupFacebookFeedbacks = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdgroupIssuesInfo.java b/src/main/java/com/facebook/ads/sdk/AdgroupIssuesInfo.java index ff0cdef6..ce7471cd 100644 --- a/src/main/java/com/facebook/ads/sdk/AdgroupIssuesInfo.java +++ b/src/main/java/com/facebook/ads/sdk/AdgroupIssuesInfo.java @@ -62,9 +62,8 @@ public String getId() { public static AdgroupIssuesInfo loadJSON(String json, APIContext context, String header) { AdgroupIssuesInfo adgroupIssuesInfo = getGson().fromJson(json, AdgroupIssuesInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adgroupIssuesInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adgroupIssuesInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList adgroupIssuesInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdgroupMetadata.java b/src/main/java/com/facebook/ads/sdk/AdgroupMetadata.java index 9aa282a5..30afcda9 100644 --- a/src/main/java/com/facebook/ads/sdk/AdgroupMetadata.java +++ b/src/main/java/com/facebook/ads/sdk/AdgroupMetadata.java @@ -62,9 +62,8 @@ public String getId() { public static AdgroupMetadata loadJSON(String json, APIContext context, String header) { AdgroupMetadata adgroupMetadata = getGson().fromJson(json, AdgroupMetadata.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adgroupMetadata.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adgroupMetadata.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adgroupMetadatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdgroupPlacementSpecificReviewFeedback.java b/src/main/java/com/facebook/ads/sdk/AdgroupPlacementSpecificReviewFeedback.java index 3ed7a5e3..97e1b88e 100644 --- a/src/main/java/com/facebook/ads/sdk/AdgroupPlacementSpecificReviewFeedback.java +++ b/src/main/java/com/facebook/ads/sdk/AdgroupPlacementSpecificReviewFeedback.java @@ -126,9 +126,8 @@ public String getId() { public static AdgroupPlacementSpecificReviewFeedback loadJSON(String json, APIContext context, String header) { AdgroupPlacementSpecificReviewFeedback adgroupPlacementSpecificReviewFeedback = getGson().fromJson(json, AdgroupPlacementSpecificReviewFeedback.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adgroupPlacementSpecificReviewFeedback.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adgroupPlacementSpecificReviewFeedback.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -148,10 +147,9 @@ public static APINodeList parseResponse( APINodeList adgroupPlacementSpecificReviewFeedbacks = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdgroupReviewFeedback.java b/src/main/java/com/facebook/ads/sdk/AdgroupReviewFeedback.java index eebdafaf..30abbc20 100644 --- a/src/main/java/com/facebook/ads/sdk/AdgroupReviewFeedback.java +++ b/src/main/java/com/facebook/ads/sdk/AdgroupReviewFeedback.java @@ -56,9 +56,8 @@ public String getId() { public static AdgroupReviewFeedback loadJSON(String json, APIContext context, String header) { AdgroupReviewFeedback adgroupReviewFeedback = getGson().fromJson(json, AdgroupReviewFeedback.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adgroupReviewFeedback.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adgroupReviewFeedback.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList adgroupReviewFeedbacks = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdjacentContentDeliveryReport.java b/src/main/java/com/facebook/ads/sdk/AdjacentContentDeliveryReport.java index e16af890..4e03ce96 100644 --- a/src/main/java/com/facebook/ads/sdk/AdjacentContentDeliveryReport.java +++ b/src/main/java/com/facebook/ads/sdk/AdjacentContentDeliveryReport.java @@ -58,9 +58,8 @@ public String getId() { public static AdjacentContentDeliveryReport loadJSON(String json, APIContext context, String header) { AdjacentContentDeliveryReport adjacentContentDeliveryReport = getGson().fromJson(json, AdjacentContentDeliveryReport.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adjacentContentDeliveryReport.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adjacentContentDeliveryReport.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String js APINodeList adjacentContentDeliveryReports = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsActionStats.java b/src/main/java/com/facebook/ads/sdk/AdsActionStats.java index 4a063982..6013023d 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsActionStats.java +++ b/src/main/java/com/facebook/ads/sdk/AdsActionStats.java @@ -152,9 +152,8 @@ public String getId() { public static AdsActionStats loadJSON(String json, APIContext context, String header) { AdsActionStats adsActionStats = getGson().fromJson(json, AdsActionStats.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsActionStats.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsActionStats.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -174,10 +173,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adsActionStatss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsAnomalyDetection.java b/src/main/java/com/facebook/ads/sdk/AdsAnomalyDetection.java index 9367765d..e15a5c9e 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsAnomalyDetection.java +++ b/src/main/java/com/facebook/ads/sdk/AdsAnomalyDetection.java @@ -56,9 +56,8 @@ public String getId() { public static AdsAnomalyDetection loadJSON(String json, APIContext context, String header) { AdsAnomalyDetection adsAnomalyDetection = getGson().fromJson(json, AdsAnomalyDetection.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsAnomalyDetection.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsAnomalyDetection.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList adsAnomalyDetections = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsConversionGoal.java b/src/main/java/com/facebook/ads/sdk/AdsConversionGoal.java index f2843b46..0468d294 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsConversionGoal.java +++ b/src/main/java/com/facebook/ads/sdk/AdsConversionGoal.java @@ -127,9 +127,8 @@ public String getId() { public static AdsConversionGoal loadJSON(String json, APIContext context, String header) { AdsConversionGoal adsConversionGoal = getGson().fromJson(json, AdsConversionGoal.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsConversionGoal.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsConversionGoal.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -149,10 +148,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList adsConversionGoals = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsCreationSavedState.java b/src/main/java/com/facebook/ads/sdk/AdsCreationSavedState.java index 43e942d2..39fd8b56 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsCreationSavedState.java +++ b/src/main/java/com/facebook/ads/sdk/AdsCreationSavedState.java @@ -121,9 +121,8 @@ public String getId() { public static AdsCreationSavedState loadJSON(String json, APIContext context, String header) { AdsCreationSavedState adsCreationSavedState = getGson().fromJson(json, AdsCreationSavedState.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsCreationSavedState.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsCreationSavedState.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList adsCreationSavedStates = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsCustomPivotsPreview.java b/src/main/java/com/facebook/ads/sdk/AdsCustomPivotsPreview.java index 35a40585..32e66464 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsCustomPivotsPreview.java +++ b/src/main/java/com/facebook/ads/sdk/AdsCustomPivotsPreview.java @@ -70,9 +70,8 @@ public String getId() { public static AdsCustomPivotsPreview loadJSON(String json, APIContext context, String header) { AdsCustomPivotsPreview adsCustomPivotsPreview = getGson().fromJson(json, AdsCustomPivotsPreview.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsCustomPivotsPreview.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsCustomPivotsPreview.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse(String json, API APINodeList adsCustomPivotsPreviews = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsDataPartner.java b/src/main/java/com/facebook/ads/sdk/AdsDataPartner.java index 1237931c..ca78ed12 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsDataPartner.java +++ b/src/main/java/com/facebook/ads/sdk/AdsDataPartner.java @@ -117,9 +117,8 @@ public String getId() { public static AdsDataPartner loadJSON(String json, APIContext context, String header) { AdsDataPartner adsDataPartner = getGson().fromJson(json, AdsDataPartner.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsDataPartner.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsDataPartner.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adsDataPartners = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsDataset.java b/src/main/java/com/facebook/ads/sdk/AdsDataset.java index 44c2a7e3..6cba83a3 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsDataset.java +++ b/src/main/java/com/facebook/ads/sdk/AdsDataset.java @@ -156,9 +156,8 @@ public String getId() { public static AdsDataset loadJSON(String json, APIContext context, String header) { AdsDataset adsDataset = getGson().fromJson(json, AdsDataset.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsDataset.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsDataset.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -178,10 +177,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList adsDatasets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsGuidanceQEExposure.java b/src/main/java/com/facebook/ads/sdk/AdsGuidanceQEExposure.java index d7653caa..15373da5 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsGuidanceQEExposure.java +++ b/src/main/java/com/facebook/ads/sdk/AdsGuidanceQEExposure.java @@ -54,9 +54,8 @@ public String getId() { public static AdsGuidanceQEExposure loadJSON(String json, APIContext context, String header) { AdsGuidanceQEExposure adsGuidanceQEExposure = getGson().fromJson(json, AdsGuidanceQEExposure.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsGuidanceQEExposure.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsGuidanceQEExposure.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList adsGuidanceQEExposures = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsHistogramStats.java b/src/main/java/com/facebook/ads/sdk/AdsHistogramStats.java index c0f7232b..e00e96eb 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsHistogramStats.java +++ b/src/main/java/com/facebook/ads/sdk/AdsHistogramStats.java @@ -152,9 +152,8 @@ public String getId() { public static AdsHistogramStats loadJSON(String json, APIContext context, String header) { AdsHistogramStats adsHistogramStats = getGson().fromJson(json, AdsHistogramStats.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsHistogramStats.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsHistogramStats.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -174,10 +173,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList adsHistogramStatss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsImageCrops.java b/src/main/java/com/facebook/ads/sdk/AdsImageCrops.java index 9d80a5ec..79b8bf99 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsImageCrops.java +++ b/src/main/java/com/facebook/ads/sdk/AdsImageCrops.java @@ -66,9 +66,8 @@ public String getId() { public static AdsImageCrops loadJSON(String json, APIContext context, String header) { AdsImageCrops adsImageCrops = getGson().fromJson(json, AdsImageCrops.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsImageCrops.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsImageCrops.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList adsImageCropss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsInsights.java b/src/main/java/com/facebook/ads/sdk/AdsInsights.java index 0049fbc5..713d0679 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsInsights.java +++ b/src/main/java/com/facebook/ads/sdk/AdsInsights.java @@ -425,9 +425,8 @@ public String getId() { public static AdsInsights loadJSON(String json, APIContext context, String header) { AdsInsights adsInsights = getGson().fromJson(json, AdsInsights.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsInsights.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsInsights.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -447,10 +446,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList adsInsightss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsNamingTemplate.java b/src/main/java/com/facebook/ads/sdk/AdsNamingTemplate.java index 90b58d17..61b86536 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsNamingTemplate.java +++ b/src/main/java/com/facebook/ads/sdk/AdsNamingTemplate.java @@ -129,9 +129,8 @@ public String getId() { public static AdsNamingTemplate loadJSON(String json, APIContext context, String header) { AdsNamingTemplate adsNamingTemplate = getGson().fromJson(json, AdsNamingTemplate.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsNamingTemplate.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsNamingTemplate.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList adsNamingTemplates = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsOptimalDeliveryGrowthOpportunity.java b/src/main/java/com/facebook/ads/sdk/AdsOptimalDeliveryGrowthOpportunity.java index be9e7072..30dddaeb 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsOptimalDeliveryGrowthOpportunity.java +++ b/src/main/java/com/facebook/ads/sdk/AdsOptimalDeliveryGrowthOpportunity.java @@ -58,9 +58,8 @@ public String getId() { public static AdsOptimalDeliveryGrowthOpportunity loadJSON(String json, APIContext context, String header) { AdsOptimalDeliveryGrowthOpportunity adsOptimalDeliveryGrowthOpportunity = getGson().fromJson(json, AdsOptimalDeliveryGrowthOpportunity.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsOptimalDeliveryGrowthOpportunity.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsOptimalDeliveryGrowthOpportunity.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(Str APINodeList adsOptimalDeliveryGrowthOpportunitys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPaymentCycle.java b/src/main/java/com/facebook/ads/sdk/AdsPaymentCycle.java index ebb00a7d..26f83536 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPaymentCycle.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPaymentCycle.java @@ -64,9 +64,8 @@ public String getId() { public static AdsPaymentCycle loadJSON(String json, APIContext context, String header) { AdsPaymentCycle adsPaymentCycle = getGson().fromJson(json, AdsPaymentCycle.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPaymentCycle.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPaymentCycle.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adsPaymentCycles = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPivotRules.java b/src/main/java/com/facebook/ads/sdk/AdsPivotRules.java index 2bac4552..7547ec22 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPivotRules.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPivotRules.java @@ -131,9 +131,8 @@ public String getId() { public static AdsPivotRules loadJSON(String json, APIContext context, String header) { AdsPivotRules adsPivotRules = getGson().fromJson(json, AdsPivotRules.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPivotRules.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPivotRules.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -153,10 +152,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList adsPivotRuless = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixel.java b/src/main/java/com/facebook/ads/sdk/AdsPixel.java index 14f35578..42c73e63 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixel.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixel.java @@ -179,9 +179,8 @@ public String getId() { public static AdsPixel loadJSON(String json, APIContext context, String header) { AdsPixel adsPixel = getGson().fromJson(json, AdsPixel.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixel.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixel.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -201,10 +200,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList adsPixels = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixelCAPISetupQuality.java b/src/main/java/com/facebook/ads/sdk/AdsPixelCAPISetupQuality.java index e626ce25..2a570497 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixelCAPISetupQuality.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixelCAPISetupQuality.java @@ -56,9 +56,8 @@ public String getId() { public static AdsPixelCAPISetupQuality loadJSON(String json, APIContext context, String header) { AdsPixelCAPISetupQuality adsPixelCAPISetupQuality = getGson().fromJson(json, AdsPixelCAPISetupQuality.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixelCAPISetupQuality.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixelCAPISetupQuality.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, A APINodeList adsPixelCAPISetupQualitys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixelCapabilityOverride.java b/src/main/java/com/facebook/ads/sdk/AdsPixelCapabilityOverride.java index f48ef723..be4cc9ac 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixelCapabilityOverride.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixelCapabilityOverride.java @@ -119,9 +119,8 @@ public String getId() { public static AdsPixelCapabilityOverride loadJSON(String json, APIContext context, String header) { AdsPixelCapabilityOverride adsPixelCapabilityOverride = getGson().fromJson(json, AdsPixelCapabilityOverride.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixelCapabilityOverride.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixelCapabilityOverride.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, APINodeList adsPixelCapabilityOverrides = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixelDeliveryRecommendations.java b/src/main/java/com/facebook/ads/sdk/AdsPixelDeliveryRecommendations.java index 7a10ebdd..63b156e1 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixelDeliveryRecommendations.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixelDeliveryRecommendations.java @@ -56,9 +56,8 @@ public String getId() { public static AdsPixelDeliveryRecommendations loadJSON(String json, APIContext context, String header) { AdsPixelDeliveryRecommendations adsPixelDeliveryRecommendations = getGson().fromJson(json, AdsPixelDeliveryRecommendations.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixelDeliveryRecommendations.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixelDeliveryRecommendations.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String APINodeList adsPixelDeliveryRecommendationss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixelDomainControlRule.java b/src/main/java/com/facebook/ads/sdk/AdsPixelDomainControlRule.java index e47d33ef..16d6519f 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixelDomainControlRule.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixelDomainControlRule.java @@ -56,9 +56,8 @@ public String getId() { public static AdsPixelDomainControlRule loadJSON(String json, APIContext context, String header) { AdsPixelDomainControlRule adsPixelDomainControlRule = getGson().fromJson(json, AdsPixelDomainControlRule.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixelDomainControlRule.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixelDomainControlRule.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APINodeList adsPixelDomainControlRules = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixelDomainLastFiredTime.java b/src/main/java/com/facebook/ads/sdk/AdsPixelDomainLastFiredTime.java index 10b664bd..a98408c6 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixelDomainLastFiredTime.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixelDomainLastFiredTime.java @@ -56,9 +56,8 @@ public String getId() { public static AdsPixelDomainLastFiredTime loadJSON(String json, APIContext context, String header) { AdsPixelDomainLastFiredTime adsPixelDomainLastFiredTime = getGson().fromJson(json, AdsPixelDomainLastFiredTime.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixelDomainLastFiredTime.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixelDomainLastFiredTime.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json APINodeList adsPixelDomainLastFiredTimes = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixelEventLastFiredTime.java b/src/main/java/com/facebook/ads/sdk/AdsPixelEventLastFiredTime.java index b33e6fd6..1c66fc0a 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixelEventLastFiredTime.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixelEventLastFiredTime.java @@ -56,9 +56,8 @@ public String getId() { public static AdsPixelEventLastFiredTime loadJSON(String json, APIContext context, String header) { AdsPixelEventLastFiredTime adsPixelEventLastFiredTime = getGson().fromJson(json, AdsPixelEventLastFiredTime.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixelEventLastFiredTime.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixelEventLastFiredTime.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APINodeList adsPixelEventLastFiredTimes = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixelEventPrediction.java b/src/main/java/com/facebook/ads/sdk/AdsPixelEventPrediction.java index 8f254600..aaecfff2 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixelEventPrediction.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixelEventPrediction.java @@ -58,9 +58,8 @@ public String getId() { public static AdsPixelEventPrediction loadJSON(String json, APIContext context, String header) { AdsPixelEventPrediction adsPixelEventPrediction = getGson().fromJson(json, AdsPixelEventPrediction.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixelEventPrediction.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixelEventPrediction.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, AP APINodeList adsPixelEventPredictions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixelEventSuggestionRule.java b/src/main/java/com/facebook/ads/sdk/AdsPixelEventSuggestionRule.java index 80072094..85c4f1b4 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixelEventSuggestionRule.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixelEventSuggestionRule.java @@ -68,9 +68,8 @@ public String getId() { public static AdsPixelEventSuggestionRule loadJSON(String json, APIContext context, String header) { AdsPixelEventSuggestionRule adsPixelEventSuggestionRule = getGson().fromJson(json, AdsPixelEventSuggestionRule.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixelEventSuggestionRule.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixelEventSuggestionRule.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String json APINodeList adsPixelEventSuggestionRules = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixelItemPrice.java b/src/main/java/com/facebook/ads/sdk/AdsPixelItemPrice.java index 404d0984..8e5aa917 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixelItemPrice.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixelItemPrice.java @@ -56,9 +56,8 @@ public String getId() { public static AdsPixelItemPrice loadJSON(String json, APIContext context, String header) { AdsPixelItemPrice adsPixelItemPrice = getGson().fromJson(json, AdsPixelItemPrice.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixelItemPrice.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixelItemPrice.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList adsPixelItemPrices = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixelMicrodataStats.java b/src/main/java/com/facebook/ads/sdk/AdsPixelMicrodataStats.java index 4bd9d546..867b6931 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixelMicrodataStats.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixelMicrodataStats.java @@ -62,9 +62,8 @@ public String getId() { public static AdsPixelMicrodataStats loadJSON(String json, APIContext context, String header) { AdsPixelMicrodataStats adsPixelMicrodataStats = getGson().fromJson(json, AdsPixelMicrodataStats.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixelMicrodataStats.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixelMicrodataStats.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, API APINodeList adsPixelMicrodataStatss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixelRawFiresResult.java b/src/main/java/com/facebook/ads/sdk/AdsPixelRawFiresResult.java index af1b7004..fc2c4ecf 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixelRawFiresResult.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixelRawFiresResult.java @@ -68,9 +68,8 @@ public String getId() { public static AdsPixelRawFiresResult loadJSON(String json, APIContext context, String header) { AdsPixelRawFiresResult adsPixelRawFiresResult = getGson().fromJson(json, AdsPixelRawFiresResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixelRawFiresResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixelRawFiresResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String json, API APINodeList adsPixelRawFiresResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixelRealTimeEventLogResult.java b/src/main/java/com/facebook/ads/sdk/AdsPixelRealTimeEventLogResult.java index 423825da..738cc6ad 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixelRealTimeEventLogResult.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixelRealTimeEventLogResult.java @@ -78,9 +78,8 @@ public String getId() { public static AdsPixelRealTimeEventLogResult loadJSON(String json, APIContext context, String header) { AdsPixelRealTimeEventLogResult adsPixelRealTimeEventLogResult = getGson().fromJson(json, AdsPixelRealTimeEventLogResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixelRealTimeEventLogResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixelRealTimeEventLogResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -100,10 +99,9 @@ public static APINodeList parseResponse(String j APINodeList adsPixelRealTimeEventLogResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixelRecentEventsResult.java b/src/main/java/com/facebook/ads/sdk/AdsPixelRecentEventsResult.java index dfde8665..62c89473 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixelRecentEventsResult.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixelRecentEventsResult.java @@ -56,9 +56,8 @@ public String getId() { public static AdsPixelRecentEventsResult loadJSON(String json, APIContext context, String header) { AdsPixelRecentEventsResult adsPixelRecentEventsResult = getGson().fromJson(json, AdsPixelRecentEventsResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixelRecentEventsResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixelRecentEventsResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APINodeList adsPixelRecentEventsResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixelSignalsIWLFeedbackNux.java b/src/main/java/com/facebook/ads/sdk/AdsPixelSignalsIWLFeedbackNux.java index c381d780..bcdd89d5 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixelSignalsIWLFeedbackNux.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixelSignalsIWLFeedbackNux.java @@ -54,9 +54,8 @@ public String getId() { public static AdsPixelSignalsIWLFeedbackNux loadJSON(String json, APIContext context, String header) { AdsPixelSignalsIWLFeedbackNux adsPixelSignalsIWLFeedbackNux = getGson().fromJson(json, AdsPixelSignalsIWLFeedbackNux.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixelSignalsIWLFeedbackNux.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixelSignalsIWLFeedbackNux.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String js APINodeList adsPixelSignalsIWLFeedbackNuxs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixelSignalsIWLNux.java b/src/main/java/com/facebook/ads/sdk/AdsPixelSignalsIWLNux.java index 36b1f8b8..0d681c7c 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixelSignalsIWLNux.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixelSignalsIWLNux.java @@ -62,9 +62,8 @@ public String getId() { public static AdsPixelSignalsIWLNux loadJSON(String json, APIContext context, String header) { AdsPixelSignalsIWLNux adsPixelSignalsIWLNux = getGson().fromJson(json, AdsPixelSignalsIWLNux.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixelSignalsIWLNux.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixelSignalsIWLNux.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList adsPixelSignalsIWLNuxs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixelStats.java b/src/main/java/com/facebook/ads/sdk/AdsPixelStats.java index 3418ce18..18d4d694 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixelStats.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixelStats.java @@ -60,9 +60,8 @@ public String getId() { public static AdsPixelStats loadJSON(String json, APIContext context, String header) { AdsPixelStats adsPixelStats = getGson().fromJson(json, AdsPixelStats.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixelStats.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixelStats.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList adsPixelStatss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsPixelStatsResult.java b/src/main/java/com/facebook/ads/sdk/AdsPixelStatsResult.java index 11f39200..ac6546ce 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsPixelStatsResult.java +++ b/src/main/java/com/facebook/ads/sdk/AdsPixelStatsResult.java @@ -58,9 +58,8 @@ public String getId() { public static AdsPixelStatsResult loadJSON(String json, APIContext context, String header) { AdsPixelStatsResult adsPixelStatsResult = getGson().fromJson(json, AdsPixelStatsResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsPixelStatsResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsPixelStatsResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList adsPixelStatsResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsQuickViews.java b/src/main/java/com/facebook/ads/sdk/AdsQuickViews.java index 2f7ac39d..db92802f 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsQuickViews.java +++ b/src/main/java/com/facebook/ads/sdk/AdsQuickViews.java @@ -127,9 +127,8 @@ public String getId() { public static AdsQuickViews loadJSON(String json, APIContext context, String header) { AdsQuickViews adsQuickViews = getGson().fromJson(json, AdsQuickViews.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsQuickViews.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsQuickViews.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -149,10 +148,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList adsQuickViewss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsReportBuilder.java b/src/main/java/com/facebook/ads/sdk/AdsReportBuilder.java index 666d3cac..031ab016 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsReportBuilder.java +++ b/src/main/java/com/facebook/ads/sdk/AdsReportBuilder.java @@ -58,9 +58,8 @@ public String getId() { public static AdsReportBuilder loadJSON(String json, APIContext context, String header) { AdsReportBuilder adsReportBuilder = getGson().fromJson(json, AdsReportBuilder.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsReportBuilder.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsReportBuilder.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList adsReportBuilders = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsReportBuilderExportCore.java b/src/main/java/com/facebook/ads/sdk/AdsReportBuilderExportCore.java index 8d481660..ec41acaf 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsReportBuilderExportCore.java +++ b/src/main/java/com/facebook/ads/sdk/AdsReportBuilderExportCore.java @@ -143,9 +143,8 @@ public String getId() { public static AdsReportBuilderExportCore loadJSON(String json, APIContext context, String header) { AdsReportBuilderExportCore adsReportBuilderExportCore = getGson().fromJson(json, AdsReportBuilderExportCore.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsReportBuilderExportCore.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsReportBuilderExportCore.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -165,10 +164,9 @@ public static APINodeList parseResponse(String json, APINodeList adsReportBuilderExportCores = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsReportBuilderMMMReport.java b/src/main/java/com/facebook/ads/sdk/AdsReportBuilderMMMReport.java index 2c0814d0..73b06b70 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsReportBuilderMMMReport.java +++ b/src/main/java/com/facebook/ads/sdk/AdsReportBuilderMMMReport.java @@ -127,9 +127,8 @@ public String getId() { public static AdsReportBuilderMMMReport loadJSON(String json, APIContext context, String header) { AdsReportBuilderMMMReport adsReportBuilderMMMReport = getGson().fromJson(json, AdsReportBuilderMMMReport.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsReportBuilderMMMReport.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsReportBuilderMMMReport.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -149,10 +148,9 @@ public static APINodeList parseResponse(String json, APINodeList adsReportBuilderMMMReports = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsReportBuilderMMMReportScheduler.java b/src/main/java/com/facebook/ads/sdk/AdsReportBuilderMMMReportScheduler.java index 7b93dca1..6a6b111b 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsReportBuilderMMMReportScheduler.java +++ b/src/main/java/com/facebook/ads/sdk/AdsReportBuilderMMMReportScheduler.java @@ -121,9 +121,8 @@ public String getId() { public static AdsReportBuilderMMMReportScheduler loadJSON(String json, APIContext context, String header) { AdsReportBuilderMMMReportScheduler adsReportBuilderMMMReportScheduler = getGson().fromJson(json, AdsReportBuilderMMMReportScheduler.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsReportBuilderMMMReportScheduler.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsReportBuilderMMMReportScheduler.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(Stri APINodeList adsReportBuilderMMMReportSchedulers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsReportBuilderSavedReport.java b/src/main/java/com/facebook/ads/sdk/AdsReportBuilderSavedReport.java index 54c4dab3..3d7723e5 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsReportBuilderSavedReport.java +++ b/src/main/java/com/facebook/ads/sdk/AdsReportBuilderSavedReport.java @@ -189,9 +189,8 @@ public String getId() { public static AdsReportBuilderSavedReport loadJSON(String json, APIContext context, String header) { AdsReportBuilderSavedReport adsReportBuilderSavedReport = getGson().fromJson(json, AdsReportBuilderSavedReport.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsReportBuilderSavedReport.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsReportBuilderSavedReport.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -211,10 +210,9 @@ public static APINodeList parseResponse(String json APINodeList adsReportBuilderSavedReports = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsSegments.java b/src/main/java/com/facebook/ads/sdk/AdsSegments.java index c11c0008..4f848015 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsSegments.java +++ b/src/main/java/com/facebook/ads/sdk/AdsSegments.java @@ -70,9 +70,8 @@ public String getId() { public static AdsSegments loadJSON(String json, APIContext context, String header) { AdsSegments adsSegments = getGson().fromJson(json, AdsSegments.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsSegments.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsSegments.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList adsSegmentss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsSignalDiagnosticIssue.java b/src/main/java/com/facebook/ads/sdk/AdsSignalDiagnosticIssue.java index 3df548de..b9fcd240 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsSignalDiagnosticIssue.java +++ b/src/main/java/com/facebook/ads/sdk/AdsSignalDiagnosticIssue.java @@ -64,9 +64,8 @@ public String getId() { public static AdsSignalDiagnosticIssue loadJSON(String json, APIContext context, String header) { AdsSignalDiagnosticIssue adsSignalDiagnosticIssue = getGson().fromJson(json, AdsSignalDiagnosticIssue.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsSignalDiagnosticIssue.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsSignalDiagnosticIssue.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, A APINodeList adsSignalDiagnosticIssues = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsStartYourDayWidget.java b/src/main/java/com/facebook/ads/sdk/AdsStartYourDayWidget.java index d5fda3fb..75f196ea 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsStartYourDayWidget.java +++ b/src/main/java/com/facebook/ads/sdk/AdsStartYourDayWidget.java @@ -115,9 +115,8 @@ public String getId() { public static AdsStartYourDayWidget loadJSON(String json, APIContext context, String header) { AdsStartYourDayWidget adsStartYourDayWidget = getGson().fromJson(json, AdsStartYourDayWidget.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsStartYourDayWidget.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsStartYourDayWidget.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList adsStartYourDayWidgets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsTabular.java b/src/main/java/com/facebook/ads/sdk/AdsTabular.java index ffef21c7..599093f9 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsTabular.java +++ b/src/main/java/com/facebook/ads/sdk/AdsTabular.java @@ -54,9 +54,8 @@ public String getId() { public static AdsTabular loadJSON(String json, APIContext context, String header) { AdsTabular adsTabular = getGson().fromJson(json, AdsTabular.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsTabular.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsTabular.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList adsTabulars = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsTargetingInsights.java b/src/main/java/com/facebook/ads/sdk/AdsTargetingInsights.java index 38fceb3b..812a64dd 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsTargetingInsights.java +++ b/src/main/java/com/facebook/ads/sdk/AdsTargetingInsights.java @@ -74,9 +74,8 @@ public String getId() { public static AdsTargetingInsights loadJSON(String json, APIContext context, String header) { AdsTargetingInsights adsTargetingInsights = getGson().fromJson(json, AdsTargetingInsights.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsTargetingInsights.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsTargetingInsights.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -96,10 +95,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList adsTargetingInsightss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsTextSuggestions.java b/src/main/java/com/facebook/ads/sdk/AdsTextSuggestions.java index cbe9b73b..be29a32a 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsTextSuggestions.java +++ b/src/main/java/com/facebook/ads/sdk/AdsTextSuggestions.java @@ -66,9 +66,8 @@ public String getId() { public static AdsTextSuggestions loadJSON(String json, APIContext context, String header) { AdsTextSuggestions adsTextSuggestions = getGson().fromJson(json, AdsTextSuggestions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsTextSuggestions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsTextSuggestions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList adsTextSuggestionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsUserSettings.java b/src/main/java/com/facebook/ads/sdk/AdsUserSettings.java index 87d1996f..3f3877bd 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsUserSettings.java +++ b/src/main/java/com/facebook/ads/sdk/AdsUserSettings.java @@ -229,9 +229,8 @@ public String getId() { public static AdsUserSettings loadJSON(String json, APIContext context, String header) { AdsUserSettings adsUserSettings = getGson().fromJson(json, AdsUserSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsUserSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsUserSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -251,10 +250,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList adsUserSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsValueAdjustmentRule.java b/src/main/java/com/facebook/ads/sdk/AdsValueAdjustmentRule.java index 383b5f6c..5e2af73a 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsValueAdjustmentRule.java +++ b/src/main/java/com/facebook/ads/sdk/AdsValueAdjustmentRule.java @@ -115,9 +115,8 @@ public String getId() { public static AdsValueAdjustmentRule loadJSON(String json, APIContext context, String header) { AdsValueAdjustmentRule adsValueAdjustmentRule = getGson().fromJson(json, AdsValueAdjustmentRule.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsValueAdjustmentRule.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsValueAdjustmentRule.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, API APINodeList adsValueAdjustmentRules = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdsValueAdjustmentRuleCollection.java b/src/main/java/com/facebook/ads/sdk/AdsValueAdjustmentRuleCollection.java index 45c3640c..8a7d321b 100644 --- a/src/main/java/com/facebook/ads/sdk/AdsValueAdjustmentRuleCollection.java +++ b/src/main/java/com/facebook/ads/sdk/AdsValueAdjustmentRuleCollection.java @@ -115,9 +115,8 @@ public String getId() { public static AdsValueAdjustmentRuleCollection loadJSON(String json, APIContext context, String header) { AdsValueAdjustmentRuleCollection adsValueAdjustmentRuleCollection = getGson().fromJson(json, AdsValueAdjustmentRuleCollection.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(adsValueAdjustmentRuleCollection.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(adsValueAdjustmentRuleCollection.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String APINodeList adsValueAdjustmentRuleCollections = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdvAInstance.java b/src/main/java/com/facebook/ads/sdk/AdvAInstance.java index b51d452d..88429713 100644 --- a/src/main/java/com/facebook/ads/sdk/AdvAInstance.java +++ b/src/main/java/com/facebook/ads/sdk/AdvAInstance.java @@ -119,9 +119,8 @@ public String getId() { public static AdvAInstance loadJSON(String json, APIContext context, String header) { AdvAInstance advAInstance = getGson().fromJson(json, AdvAInstance.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(advAInstance.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(advAInstance.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList advAInstances = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AdvertiserVerificationStatus.java b/src/main/java/com/facebook/ads/sdk/AdvertiserVerificationStatus.java index 01ae911d..66286a9c 100644 --- a/src/main/java/com/facebook/ads/sdk/AdvertiserVerificationStatus.java +++ b/src/main/java/com/facebook/ads/sdk/AdvertiserVerificationStatus.java @@ -60,9 +60,8 @@ public String getId() { public static AdvertiserVerificationStatus loadJSON(String json, APIContext context, String header) { AdvertiserVerificationStatus advertiserVerificationStatus = getGson().fromJson(json, AdvertiserVerificationStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(advertiserVerificationStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(advertiserVerificationStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String jso APINodeList advertiserVerificationStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AgeRange.java b/src/main/java/com/facebook/ads/sdk/AgeRange.java index 526c1d74..7a30e4a2 100644 --- a/src/main/java/com/facebook/ads/sdk/AgeRange.java +++ b/src/main/java/com/facebook/ads/sdk/AgeRange.java @@ -56,9 +56,8 @@ public String getId() { public static AgeRange loadJSON(String json, APIContext context, String header) { AgeRange ageRange = getGson().fromJson(json, AgeRange.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(ageRange.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(ageRange.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList ageRanges = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AgencyClientDeclaration.java b/src/main/java/com/facebook/ads/sdk/AgencyClientDeclaration.java index 418ec528..8b5b782a 100644 --- a/src/main/java/com/facebook/ads/sdk/AgencyClientDeclaration.java +++ b/src/main/java/com/facebook/ads/sdk/AgencyClientDeclaration.java @@ -76,9 +76,8 @@ public String getId() { public static AgencyClientDeclaration loadJSON(String json, APIContext context, String header) { AgencyClientDeclaration agencyClientDeclaration = getGson().fromJson(json, AgencyClientDeclaration.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(agencyClientDeclaration.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(agencyClientDeclaration.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -98,10 +97,9 @@ public static APINodeList parseResponse(String json, AP APINodeList agencyClientDeclarations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Album.java b/src/main/java/com/facebook/ads/sdk/Album.java index 2d143ddd..36ab64f3 100644 --- a/src/main/java/com/facebook/ads/sdk/Album.java +++ b/src/main/java/com/facebook/ads/sdk/Album.java @@ -157,9 +157,8 @@ public String getId() { public static Album loadJSON(String json, APIContext context, String header) { Album album = getGson().fromJson(json, Album.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(album.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(album.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -179,10 +178,9 @@ public static APINodeList parseResponse(String json, APIContext context, APINodeList albums = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AnalyticsCohortQueryResult.java b/src/main/java/com/facebook/ads/sdk/AnalyticsCohortQueryResult.java deleted file mode 100644 index 9fc66d9c..00000000 --- a/src/main/java/com/facebook/ads/sdk/AnalyticsCohortQueryResult.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.ads.sdk; - -import java.io.File; -import java.lang.reflect.Modifier; -import java.lang.reflect.Type; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.google.common.base.Function; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.MoreExecutors; -import com.google.common.util.concurrent.SettableFuture; -import com.google.gson.JsonObject; -import com.google.gson.JsonArray; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonElement; -import com.google.gson.JsonParser; - -import com.facebook.ads.sdk.APIException.MalformedResponseException; - -/** - * This class is auto-generated. - * - * For any issues or feature requests related to this class, please let us know - * on github and we'll fix in our codegen framework. We'll not be able to accept - * pull request for this class. - * - */ -public class AnalyticsCohortQueryResult extends APINode { - @SerializedName("data") - private Object mData = null; - @SerializedName("error") - private Object mError = null; - @SerializedName("query_id") - private String mQueryId = null; - @SerializedName("status") - private String mStatus = null; - protected static Gson gson = null; - - public AnalyticsCohortQueryResult() { - } - - public String getId() { - return null; - } - public static AnalyticsCohortQueryResult loadJSON(String json, APIContext context, String header) { - AnalyticsCohortQueryResult analyticsCohortQueryResult = getGson().fromJson(json, AnalyticsCohortQueryResult.class); - if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(analyticsCohortQueryResult.toString()); - if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { - o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); - } - if (!o1.equals(o2)) { - context.log("[Warning] When parsing response, object is not consistent with JSON:"); - context.log("[JSON]" + o1); - context.log("[Object]" + o2); - } - } - analyticsCohortQueryResult.context = context; - analyticsCohortQueryResult.rawValue = json; - analyticsCohortQueryResult.header = header; - return analyticsCohortQueryResult; - } - - public static APINodeList parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException { - APINodeList analyticsCohortQueryResults = new APINodeList(request, json, header); - JsonArray arr; - JsonObject obj; - JsonParser parser = new JsonParser(); - Exception exception = null; - try{ - JsonElement result = parser.parse(json); - if (result.isJsonArray()) { - // First, check if it's a pure JSON Array - arr = result.getAsJsonArray(); - for (int i = 0; i < arr.size(); i++) { - analyticsCohortQueryResults.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); - }; - return analyticsCohortQueryResults; - } else if (result.isJsonObject()) { - obj = result.getAsJsonObject(); - if (obj.has("data")) { - if (obj.has("paging")) { - JsonObject paging = obj.get("paging").getAsJsonObject(); - if (paging.has("cursors")) { - JsonObject cursors = paging.get("cursors").getAsJsonObject(); - String before = cursors.has("before") ? cursors.get("before").getAsString() : null; - String after = cursors.has("after") ? cursors.get("after").getAsString() : null; - analyticsCohortQueryResults.setCursors(before, after); - } - String previous = paging.has("previous") ? paging.get("previous").getAsString() : null; - String next = paging.has("next") ? paging.get("next").getAsString() : null; - analyticsCohortQueryResults.setPaging(previous, next); - if (context.hasAppSecret()) { - analyticsCohortQueryResults.setAppSecret(context.getAppSecretProof()); - } - } - if (obj.get("data").isJsonArray()) { - // Second, check if it's a JSON array with "data" - arr = obj.get("data").getAsJsonArray(); - for (int i = 0; i < arr.size(); i++) { - analyticsCohortQueryResults.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header)); - }; - } else if (obj.get("data").isJsonObject()) { - // Third, check if it's a JSON object with "data" - obj = obj.get("data").getAsJsonObject(); - boolean isRedownload = false; - for (String s : new String[]{"campaigns", "adsets", "ads"}) { - if (obj.has(s)) { - isRedownload = true; - obj = obj.getAsJsonObject(s); - for (Map.Entry entry : obj.entrySet()) { - analyticsCohortQueryResults.add(loadJSON(entry.getValue().toString(), context, header)); - } - break; - } - } - if (!isRedownload) { - analyticsCohortQueryResults.add(loadJSON(obj.toString(), context, header)); - } - } - return analyticsCohortQueryResults; - } else if (obj.has("images")) { - // Fourth, check if it's a map of image objects - obj = obj.get("images").getAsJsonObject(); - for (Map.Entry entry : obj.entrySet()) { - analyticsCohortQueryResults.add(loadJSON(entry.getValue().toString(), context, header)); - } - return analyticsCohortQueryResults; - } else { - // Fifth, check if it's an array of objects indexed by id - boolean isIdIndexedArray = true; - for (Map.Entry entry : obj.entrySet()) { - String key = (String) entry.getKey(); - if (key.equals("__fb_trace_id__")) { - continue; - } - JsonElement value = (JsonElement) entry.getValue(); - if ( - value != null && - value.isJsonObject() && - value.getAsJsonObject().has("id") && - value.getAsJsonObject().get("id") != null && - value.getAsJsonObject().get("id").getAsString().equals(key) - ) { - analyticsCohortQueryResults.add(loadJSON(value.toString(), context, header)); - } else { - isIdIndexedArray = false; - break; - } - } - if (isIdIndexedArray) { - return analyticsCohortQueryResults; - } - - // Sixth, check if it's pure JsonObject - analyticsCohortQueryResults.clear(); - analyticsCohortQueryResults.add(loadJSON(json, context, header)); - return analyticsCohortQueryResults; - } - } - } catch (Exception e) { - exception = e; - } - throw new MalformedResponseException( - "Invalid response string: " + json, - exception - ); - } - - @Override - public APIContext getContext() { - return context; - } - - @Override - public void setContext(APIContext context) { - this.context = context; - } - - @Override - public String toString() { - return getGson().toJson(this); - } - - - public Object getFieldData() { - return mData; - } - - public AnalyticsCohortQueryResult setFieldData(Object value) { - this.mData = value; - return this; - } - - public Object getFieldError() { - return mError; - } - - public AnalyticsCohortQueryResult setFieldError(Object value) { - this.mError = value; - return this; - } - - public String getFieldQueryId() { - return mQueryId; - } - - public AnalyticsCohortQueryResult setFieldQueryId(String value) { - this.mQueryId = value; - return this; - } - - public String getFieldStatus() { - return mStatus; - } - - public AnalyticsCohortQueryResult setFieldStatus(String value) { - this.mStatus = value; - return this; - } - - - - - synchronized /*package*/ static Gson getGson() { - if (gson != null) { - return gson; - } else { - gson = new GsonBuilder() - .excludeFieldsWithModifiers(Modifier.STATIC) - .excludeFieldsWithModifiers(Modifier.PROTECTED) - .disableHtmlEscaping() - .create(); - } - return gson; - } - - public AnalyticsCohortQueryResult copyFrom(AnalyticsCohortQueryResult instance) { - this.mData = instance.mData; - this.mError = instance.mError; - this.mQueryId = instance.mQueryId; - this.mStatus = instance.mStatus; - this.context = instance.context; - this.rawValue = instance.rawValue; - return this; - } - - public static APIRequest.ResponseParser getParser() { - return new APIRequest.ResponseParser() { - public APINodeList parseResponse(String response, APIContext context, APIRequest request, String header) throws MalformedResponseException { - return AnalyticsCohortQueryResult.parseResponse(response, context, request, header); - } - }; - } -} diff --git a/src/main/java/com/facebook/ads/sdk/AnalyticsConfig.java b/src/main/java/com/facebook/ads/sdk/AnalyticsConfig.java index 047627b6..f0fc5a3d 100644 --- a/src/main/java/com/facebook/ads/sdk/AnalyticsConfig.java +++ b/src/main/java/com/facebook/ads/sdk/AnalyticsConfig.java @@ -104,9 +104,8 @@ public String getId() { public static AnalyticsConfig loadJSON(String json, APIContext context, String header) { AnalyticsConfig analyticsConfig = getGson().fromJson(json, AnalyticsConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(analyticsConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(analyticsConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -126,10 +125,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList analyticsConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AnalyticsEntityUserConfig.java b/src/main/java/com/facebook/ads/sdk/AnalyticsEntityUserConfig.java index 0654da48..a5839703 100644 --- a/src/main/java/com/facebook/ads/sdk/AnalyticsEntityUserConfig.java +++ b/src/main/java/com/facebook/ads/sdk/AnalyticsEntityUserConfig.java @@ -54,9 +54,8 @@ public String getId() { public static AnalyticsEntityUserConfig loadJSON(String json, APIContext context, String header) { AnalyticsEntityUserConfig analyticsEntityUserConfig = getGson().fromJson(json, AnalyticsEntityUserConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(analyticsEntityUserConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(analyticsEntityUserConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APINodeList analyticsEntityUserConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AnalyticsFunnelQueryResult.java b/src/main/java/com/facebook/ads/sdk/AnalyticsFunnelQueryResult.java index 1b37abd3..98d873e8 100644 --- a/src/main/java/com/facebook/ads/sdk/AnalyticsFunnelQueryResult.java +++ b/src/main/java/com/facebook/ads/sdk/AnalyticsFunnelQueryResult.java @@ -60,9 +60,8 @@ public String getId() { public static AnalyticsFunnelQueryResult loadJSON(String json, APIContext context, String header) { AnalyticsFunnelQueryResult analyticsFunnelQueryResult = getGson().fromJson(json, AnalyticsFunnelQueryResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(analyticsFunnelQueryResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(analyticsFunnelQueryResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APINodeList analyticsFunnelQueryResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AnalyticsPlatformMetricsConfig.java b/src/main/java/com/facebook/ads/sdk/AnalyticsPlatformMetricsConfig.java index e9a4a38c..74e603c3 100644 --- a/src/main/java/com/facebook/ads/sdk/AnalyticsPlatformMetricsConfig.java +++ b/src/main/java/com/facebook/ads/sdk/AnalyticsPlatformMetricsConfig.java @@ -70,9 +70,8 @@ public String getId() { public static AnalyticsPlatformMetricsConfig loadJSON(String json, APIContext context, String header) { AnalyticsPlatformMetricsConfig analyticsPlatformMetricsConfig = getGson().fromJson(json, AnalyticsPlatformMetricsConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(analyticsPlatformMetricsConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(analyticsPlatformMetricsConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse(String j APINodeList analyticsPlatformMetricsConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AnalyticsQueryResult.java b/src/main/java/com/facebook/ads/sdk/AnalyticsQueryResult.java index d7a56f31..55269b9d 100644 --- a/src/main/java/com/facebook/ads/sdk/AnalyticsQueryResult.java +++ b/src/main/java/com/facebook/ads/sdk/AnalyticsQueryResult.java @@ -62,9 +62,8 @@ public String getId() { public static AnalyticsQueryResult loadJSON(String json, APIContext context, String header) { AnalyticsQueryResult analyticsQueryResult = getGson().fromJson(json, AnalyticsQueryResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(analyticsQueryResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(analyticsQueryResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList analyticsQueryResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AnalyticsSegment.java b/src/main/java/com/facebook/ads/sdk/AnalyticsSegment.java index 6275f0a5..f39bb73d 100644 --- a/src/main/java/com/facebook/ads/sdk/AnalyticsSegment.java +++ b/src/main/java/com/facebook/ads/sdk/AnalyticsSegment.java @@ -145,9 +145,8 @@ public String getId() { public static AnalyticsSegment loadJSON(String json, APIContext context, String header) { AnalyticsSegment analyticsSegment = getGson().fromJson(json, AnalyticsSegment.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(analyticsSegment.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(analyticsSegment.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -167,10 +166,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList analyticsSegments = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AnalyticsUserConfig.java b/src/main/java/com/facebook/ads/sdk/AnalyticsUserConfig.java index 583fd677..de2e93fd 100644 --- a/src/main/java/com/facebook/ads/sdk/AnalyticsUserConfig.java +++ b/src/main/java/com/facebook/ads/sdk/AnalyticsUserConfig.java @@ -117,9 +117,8 @@ public String getId() { public static AnalyticsUserConfig loadJSON(String json, APIContext context, String header) { AnalyticsUserConfig analyticsUserConfig = getGson().fromJson(json, AnalyticsUserConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(analyticsUserConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(analyticsUserConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList analyticsUserConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AndroidAppLink.java b/src/main/java/com/facebook/ads/sdk/AndroidAppLink.java index 8231fd4a..bd72157e 100644 --- a/src/main/java/com/facebook/ads/sdk/AndroidAppLink.java +++ b/src/main/java/com/facebook/ads/sdk/AndroidAppLink.java @@ -60,9 +60,8 @@ public String getId() { public static AndroidAppLink loadJSON(String json, APIContext context, String header) { AndroidAppLink androidAppLink = getGson().fromJson(json, AndroidAppLink.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(androidAppLink.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(androidAppLink.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList androidAppLinks = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AppEventConfig.java b/src/main/java/com/facebook/ads/sdk/AppEventConfig.java index 8f5c7fdf..7593ce5d 100644 --- a/src/main/java/com/facebook/ads/sdk/AppEventConfig.java +++ b/src/main/java/com/facebook/ads/sdk/AppEventConfig.java @@ -165,9 +165,8 @@ public String getId() { public static AppEventConfig loadJSON(String json, APIContext context, String header) { AppEventConfig appEventConfig = getGson().fromJson(json, AppEventConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(appEventConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(appEventConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -187,10 +186,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList appEventConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AppLinks.java b/src/main/java/com/facebook/ads/sdk/AppLinks.java index 180173c2..a0f8a08b 100644 --- a/src/main/java/com/facebook/ads/sdk/AppLinks.java +++ b/src/main/java/com/facebook/ads/sdk/AppLinks.java @@ -129,9 +129,8 @@ public String getId() { public static AppLinks loadJSON(String json, APIContext context, String header) { AppLinks appLinks = getGson().fromJson(json, AppLinks.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(appLinks.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(appLinks.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList appLinkss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AppOptimizedCustomEvents.java b/src/main/java/com/facebook/ads/sdk/AppOptimizedCustomEvents.java index fdda1a4f..1d1cc407 100644 --- a/src/main/java/com/facebook/ads/sdk/AppOptimizedCustomEvents.java +++ b/src/main/java/com/facebook/ads/sdk/AppOptimizedCustomEvents.java @@ -58,9 +58,8 @@ public String getId() { public static AppOptimizedCustomEvents loadJSON(String json, APIContext context, String header) { AppOptimizedCustomEvents appOptimizedCustomEvents = getGson().fromJson(json, AppOptimizedCustomEvents.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(appOptimizedCustomEvents.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(appOptimizedCustomEvents.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, A APINodeList appOptimizedCustomEventss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AppPublisher.java b/src/main/java/com/facebook/ads/sdk/AppPublisher.java index c040e23a..ca4c7691 100644 --- a/src/main/java/com/facebook/ads/sdk/AppPublisher.java +++ b/src/main/java/com/facebook/ads/sdk/AppPublisher.java @@ -66,9 +66,8 @@ public String getId() { public static AppPublisher loadJSON(String json, APIContext context, String header) { AppPublisher appPublisher = getGson().fromJson(json, AppPublisher.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(appPublisher.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(appPublisher.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList appPublishers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AppRequest.java b/src/main/java/com/facebook/ads/sdk/AppRequest.java index a0f5ddcd..3c4b2308 100644 --- a/src/main/java/com/facebook/ads/sdk/AppRequest.java +++ b/src/main/java/com/facebook/ads/sdk/AppRequest.java @@ -129,9 +129,8 @@ public String getId() { public static AppRequest loadJSON(String json, APIContext context, String header) { AppRequest appRequest = getGson().fromJson(json, AppRequest.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(appRequest.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(appRequest.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList appRequests = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AppRequestFormerRecipient.java b/src/main/java/com/facebook/ads/sdk/AppRequestFormerRecipient.java index 9c9a5401..c10f2cbf 100644 --- a/src/main/java/com/facebook/ads/sdk/AppRequestFormerRecipient.java +++ b/src/main/java/com/facebook/ads/sdk/AppRequestFormerRecipient.java @@ -56,9 +56,8 @@ public String getId() { public static AppRequestFormerRecipient loadJSON(String json, APIContext context, String header) { AppRequestFormerRecipient appRequestFormerRecipient = getGson().fromJson(json, AppRequestFormerRecipient.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(appRequestFormerRecipient.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(appRequestFormerRecipient.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APINodeList appRequestFormerRecipients = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Application.java b/src/main/java/com/facebook/ads/sdk/Application.java index bb70bb81..6ca84174 100644 --- a/src/main/java/com/facebook/ads/sdk/Application.java +++ b/src/main/java/com/facebook/ads/sdk/Application.java @@ -321,9 +321,8 @@ public String getId() { public static Application loadJSON(String json, APIContext context, String header) { Application application = getGson().fromJson(json, Application.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(application.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(application.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -343,10 +342,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList applications = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ArAdsDataContainer.java b/src/main/java/com/facebook/ads/sdk/ArAdsDataContainer.java index 6dece5e5..e84edc5f 100644 --- a/src/main/java/com/facebook/ads/sdk/ArAdsDataContainer.java +++ b/src/main/java/com/facebook/ads/sdk/ArAdsDataContainer.java @@ -125,9 +125,8 @@ public String getId() { public static ArAdsDataContainer loadJSON(String json, APIContext context, String header) { ArAdsDataContainer arAdsDataContainer = getGson().fromJson(json, ArAdsDataContainer.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(arAdsDataContainer.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(arAdsDataContainer.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList arAdsDataContainers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AssignedUser.java b/src/main/java/com/facebook/ads/sdk/AssignedUser.java index d22683c8..3569fb8c 100644 --- a/src/main/java/com/facebook/ads/sdk/AssignedUser.java +++ b/src/main/java/com/facebook/ads/sdk/AssignedUser.java @@ -60,9 +60,8 @@ public String getId() { public static AssignedUser loadJSON(String json, APIContext context, String header) { AssignedUser assignedUser = getGson().fromJson(json, AssignedUser.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(assignedUser.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(assignedUser.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList assignedUsers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AsyncRequest.java b/src/main/java/com/facebook/ads/sdk/AsyncRequest.java index 1c8cf024..2aaf2d18 100644 --- a/src/main/java/com/facebook/ads/sdk/AsyncRequest.java +++ b/src/main/java/com/facebook/ads/sdk/AsyncRequest.java @@ -60,9 +60,8 @@ public String getId() { public static AsyncRequest loadJSON(String json, APIContext context, String header) { AsyncRequest asyncRequest = getGson().fromJson(json, AsyncRequest.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(asyncRequest.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(asyncRequest.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList asyncRequests = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AsyncSession.java b/src/main/java/com/facebook/ads/sdk/AsyncSession.java index 0b6ca0d6..ca0bcb47 100644 --- a/src/main/java/com/facebook/ads/sdk/AsyncSession.java +++ b/src/main/java/com/facebook/ads/sdk/AsyncSession.java @@ -141,9 +141,8 @@ public String getId() { public static AsyncSession loadJSON(String json, APIContext context, String header) { AsyncSession asyncSession = getGson().fromJson(json, AsyncSession.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(asyncSession.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(asyncSession.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -163,10 +162,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList asyncSessions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AttributionSpec.java b/src/main/java/com/facebook/ads/sdk/AttributionSpec.java index 08e43a30..5e772c3a 100644 --- a/src/main/java/com/facebook/ads/sdk/AttributionSpec.java +++ b/src/main/java/com/facebook/ads/sdk/AttributionSpec.java @@ -56,9 +56,8 @@ public String getId() { public static AttributionSpec loadJSON(String json, APIContext context, String header) { AttributionSpec attributionSpec = getGson().fromJson(json, AttributionSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(attributionSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(attributionSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList attributionSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AudienceFunnel.java b/src/main/java/com/facebook/ads/sdk/AudienceFunnel.java index 5e061468..d6f261ec 100644 --- a/src/main/java/com/facebook/ads/sdk/AudienceFunnel.java +++ b/src/main/java/com/facebook/ads/sdk/AudienceFunnel.java @@ -58,9 +58,8 @@ public String getId() { public static AudienceFunnel loadJSON(String json, APIContext context, String header) { AudienceFunnel audienceFunnel = getGson().fromJson(json, AudienceFunnel.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(audienceFunnel.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(audienceFunnel.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList audienceFunnels = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AudienceOverlap.java b/src/main/java/com/facebook/ads/sdk/AudienceOverlap.java index 1276ba18..68063430 100644 --- a/src/main/java/com/facebook/ads/sdk/AudienceOverlap.java +++ b/src/main/java/com/facebook/ads/sdk/AudienceOverlap.java @@ -60,9 +60,8 @@ public String getId() { public static AudienceOverlap loadJSON(String json, APIContext context, String header) { AudienceOverlap audienceOverlap = getGson().fromJson(json, AudienceOverlap.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(audienceOverlap.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(audienceOverlap.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList audienceOverlaps = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AudiencePermission.java b/src/main/java/com/facebook/ads/sdk/AudiencePermission.java index 4ef2583d..b44fc07b 100644 --- a/src/main/java/com/facebook/ads/sdk/AudiencePermission.java +++ b/src/main/java/com/facebook/ads/sdk/AudiencePermission.java @@ -58,9 +58,8 @@ public String getId() { public static AudiencePermission loadJSON(String json, APIContext context, String header) { AudiencePermission audiencePermission = getGson().fromJson(json, AudiencePermission.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(audiencePermission.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(audiencePermission.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList audiencePermissions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AudiencePermissionForActions.java b/src/main/java/com/facebook/ads/sdk/AudiencePermissionForActions.java index 0996a7b6..14af87de 100644 --- a/src/main/java/com/facebook/ads/sdk/AudiencePermissionForActions.java +++ b/src/main/java/com/facebook/ads/sdk/AudiencePermissionForActions.java @@ -62,9 +62,8 @@ public String getId() { public static AudiencePermissionForActions loadJSON(String json, APIContext context, String header) { AudiencePermissionForActions audiencePermissionForActions = getGson().fromJson(json, AudiencePermissionForActions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(audiencePermissionForActions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(audiencePermissionForActions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String jso APINodeList audiencePermissionForActionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AudienceSharingAccountValid.java b/src/main/java/com/facebook/ads/sdk/AudienceSharingAccountValid.java index cd02e1ee..f4991d00 100644 --- a/src/main/java/com/facebook/ads/sdk/AudienceSharingAccountValid.java +++ b/src/main/java/com/facebook/ads/sdk/AudienceSharingAccountValid.java @@ -64,9 +64,8 @@ public String getId() { public static AudienceSharingAccountValid loadJSON(String json, APIContext context, String header) { AudienceSharingAccountValid audienceSharingAccountValid = getGson().fromJson(json, AudienceSharingAccountValid.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(audienceSharingAccountValid.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(audienceSharingAccountValid.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json APINodeList audienceSharingAccountValids = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AudienceSharingRecipientAccounts.java b/src/main/java/com/facebook/ads/sdk/AudienceSharingRecipientAccounts.java index 1b3d8b62..245b0944 100644 --- a/src/main/java/com/facebook/ads/sdk/AudienceSharingRecipientAccounts.java +++ b/src/main/java/com/facebook/ads/sdk/AudienceSharingRecipientAccounts.java @@ -66,9 +66,8 @@ public String getId() { public static AudienceSharingRecipientAccounts loadJSON(String json, APIContext context, String header) { AudienceSharingRecipientAccounts audienceSharingRecipientAccounts = getGson().fromJson(json, AudienceSharingRecipientAccounts.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(audienceSharingRecipientAccounts.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(audienceSharingRecipientAccounts.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String APINodeList audienceSharingRecipientAccountss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AudioAsset.java b/src/main/java/com/facebook/ads/sdk/AudioAsset.java index 09ae1f41..1b0306f6 100644 --- a/src/main/java/com/facebook/ads/sdk/AudioAsset.java +++ b/src/main/java/com/facebook/ads/sdk/AudioAsset.java @@ -149,9 +149,8 @@ public String getId() { public static AudioAsset loadJSON(String json, APIContext context, String header) { AudioAsset audioAsset = getGson().fromJson(json, AudioAsset.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(audioAsset.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(audioAsset.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -171,10 +170,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList audioAssets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AudioCopyright.java b/src/main/java/com/facebook/ads/sdk/AudioCopyright.java index 893e202c..0526ee10 100644 --- a/src/main/java/com/facebook/ads/sdk/AudioCopyright.java +++ b/src/main/java/com/facebook/ads/sdk/AudioCopyright.java @@ -139,9 +139,8 @@ public String getId() { public static AudioCopyright loadJSON(String json, APIContext context, String header) { AudioCopyright audioCopyright = getGson().fromJson(json, AudioCopyright.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(audioCopyright.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(audioCopyright.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -161,10 +160,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList audioCopyrights = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AudioIsrc.java b/src/main/java/com/facebook/ads/sdk/AudioIsrc.java index 0b7e6f90..9388d0fa 100644 --- a/src/main/java/com/facebook/ads/sdk/AudioIsrc.java +++ b/src/main/java/com/facebook/ads/sdk/AudioIsrc.java @@ -129,9 +129,8 @@ public String getId() { public static AudioIsrc loadJSON(String json, APIContext context, String header) { AudioIsrc audioIsrc = getGson().fromJson(json, AudioIsrc.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(audioIsrc.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(audioIsrc.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse(String json, APIContext conte APINodeList audioIsrcs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AudioRelease.java b/src/main/java/com/facebook/ads/sdk/AudioRelease.java index e743b4a8..34094ace 100644 --- a/src/main/java/com/facebook/ads/sdk/AudioRelease.java +++ b/src/main/java/com/facebook/ads/sdk/AudioRelease.java @@ -143,9 +143,8 @@ public String getId() { public static AudioRelease loadJSON(String json, APIContext context, String header) { AudioRelease audioRelease = getGson().fromJson(json, AudioRelease.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(audioRelease.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(audioRelease.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -165,10 +164,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList audioReleases = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AudioVisualReferenceMatch.java b/src/main/java/com/facebook/ads/sdk/AudioVisualReferenceMatch.java index baf22060..1c819d06 100644 --- a/src/main/java/com/facebook/ads/sdk/AudioVisualReferenceMatch.java +++ b/src/main/java/com/facebook/ads/sdk/AudioVisualReferenceMatch.java @@ -114,9 +114,8 @@ public String getId() { public static AudioVisualReferenceMatch loadJSON(String json, APIContext context, String header) { AudioVisualReferenceMatch audioVisualReferenceMatch = getGson().fromJson(json, AudioVisualReferenceMatch.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(audioVisualReferenceMatch.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(audioVisualReferenceMatch.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -136,10 +135,9 @@ public static APINodeList parseResponse(String json, APINodeList audioVisualReferenceMatchs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AuthLink.java b/src/main/java/com/facebook/ads/sdk/AuthLink.java index 648c3f07..3707543e 100644 --- a/src/main/java/com/facebook/ads/sdk/AuthLink.java +++ b/src/main/java/com/facebook/ads/sdk/AuthLink.java @@ -54,9 +54,8 @@ public String getId() { public static AuthLink loadJSON(String json, APIContext context, String header) { AuthLink authLink = getGson().fromJson(json, AuthLink.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(authLink.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(authLink.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList authLinks = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AutomotiveModel.java b/src/main/java/com/facebook/ads/sdk/AutomotiveModel.java index 16445102..1d082a15 100644 --- a/src/main/java/com/facebook/ads/sdk/AutomotiveModel.java +++ b/src/main/java/com/facebook/ads/sdk/AutomotiveModel.java @@ -171,9 +171,8 @@ public String getId() { public static AutomotiveModel loadJSON(String json, APIContext context, String header) { AutomotiveModel automotiveModel = getGson().fromJson(json, AutomotiveModel.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(automotiveModel.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(automotiveModel.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -193,10 +192,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList automotiveModels = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Avatar.java b/src/main/java/com/facebook/ads/sdk/Avatar.java index c8c7d087..6e4d669e 100644 --- a/src/main/java/com/facebook/ads/sdk/Avatar.java +++ b/src/main/java/com/facebook/ads/sdk/Avatar.java @@ -113,9 +113,8 @@ public String getId() { public static Avatar loadJSON(String json, APIContext context, String header) { Avatar avatar = getGson().fromJson(json, Avatar.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(avatar.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(avatar.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -135,10 +134,9 @@ public static APINodeList parseResponse(String json, APIContext context, APINodeList avatars = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/AvatarProfilePicture.java b/src/main/java/com/facebook/ads/sdk/AvatarProfilePicture.java index f5fda017..bba7b446 100644 --- a/src/main/java/com/facebook/ads/sdk/AvatarProfilePicture.java +++ b/src/main/java/com/facebook/ads/sdk/AvatarProfilePicture.java @@ -115,9 +115,8 @@ public String getId() { public static AvatarProfilePicture loadJSON(String json, APIContext context, String header) { AvatarProfilePicture avatarProfilePicture = getGson().fromJson(json, AvatarProfilePicture.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(avatarProfilePicture.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(avatarProfilePicture.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList avatarProfilePictures = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BAPIDomain.java b/src/main/java/com/facebook/ads/sdk/BAPIDomain.java index 7e2d72f9..481825ab 100644 --- a/src/main/java/com/facebook/ads/sdk/BAPIDomain.java +++ b/src/main/java/com/facebook/ads/sdk/BAPIDomain.java @@ -60,9 +60,8 @@ public String getId() { public static BAPIDomain loadJSON(String json, APIContext context, String header) { BAPIDomain bapiDomain = getGson().fromJson(json, BAPIDomain.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(bapiDomain.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(bapiDomain.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList bapiDomains = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BCPCampaign.java b/src/main/java/com/facebook/ads/sdk/BCPCampaign.java index 8b42bdfe..36b98c2e 100644 --- a/src/main/java/com/facebook/ads/sdk/BCPCampaign.java +++ b/src/main/java/com/facebook/ads/sdk/BCPCampaign.java @@ -145,9 +145,8 @@ public String getId() { public static BCPCampaign loadJSON(String json, APIContext context, String header) { BCPCampaign bcpCampaign = getGson().fromJson(json, BCPCampaign.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(bcpCampaign.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(bcpCampaign.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -167,10 +166,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList bcpCampaigns = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BespokePartnerGuidanceLaser.java b/src/main/java/com/facebook/ads/sdk/BespokePartnerGuidanceLaser.java index 19a3d2df..6211c7e2 100644 --- a/src/main/java/com/facebook/ads/sdk/BespokePartnerGuidanceLaser.java +++ b/src/main/java/com/facebook/ads/sdk/BespokePartnerGuidanceLaser.java @@ -62,9 +62,8 @@ public String getId() { public static BespokePartnerGuidanceLaser loadJSON(String json, APIContext context, String header) { BespokePartnerGuidanceLaser bespokePartnerGuidanceLaser = getGson().fromJson(json, BespokePartnerGuidanceLaser.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(bespokePartnerGuidanceLaser.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(bespokePartnerGuidanceLaser.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json APINodeList bespokePartnerGuidanceLasers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BidSchedule.java b/src/main/java/com/facebook/ads/sdk/BidSchedule.java index 74ace660..3e82683c 100644 --- a/src/main/java/com/facebook/ads/sdk/BidSchedule.java +++ b/src/main/java/com/facebook/ads/sdk/BidSchedule.java @@ -127,9 +127,8 @@ public String getId() { public static BidSchedule loadJSON(String json, APIContext context, String header) { BidSchedule bidSchedule = getGson().fromJson(json, BidSchedule.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(bidSchedule.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(bidSchedule.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -149,10 +148,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList bidSchedules = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BizInboxOffsiteEmailAccount.java b/src/main/java/com/facebook/ads/sdk/BizInboxOffsiteEmailAccount.java index 334d12a9..3435becf 100644 --- a/src/main/java/com/facebook/ads/sdk/BizInboxOffsiteEmailAccount.java +++ b/src/main/java/com/facebook/ads/sdk/BizInboxOffsiteEmailAccount.java @@ -115,9 +115,8 @@ public String getId() { public static BizInboxOffsiteEmailAccount loadJSON(String json, APIContext context, String header) { BizInboxOffsiteEmailAccount bizInboxOffsiteEmailAccount = getGson().fromJson(json, BizInboxOffsiteEmailAccount.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(bizInboxOffsiteEmailAccount.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(bizInboxOffsiteEmailAccount.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json APINodeList bizInboxOffsiteEmailAccounts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BlindPig.java b/src/main/java/com/facebook/ads/sdk/BlindPig.java index ad6734fd..03175def 100644 --- a/src/main/java/com/facebook/ads/sdk/BlindPig.java +++ b/src/main/java/com/facebook/ads/sdk/BlindPig.java @@ -115,9 +115,8 @@ public String getId() { public static BlindPig loadJSON(String json, APIContext context, String header) { BlindPig blindPig = getGson().fromJson(json, BlindPig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(blindPig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(blindPig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList blindPigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BlockedUserInfo.java b/src/main/java/com/facebook/ads/sdk/BlockedUserInfo.java index 7f75ae8e..d4473ed3 100644 --- a/src/main/java/com/facebook/ads/sdk/BlockedUserInfo.java +++ b/src/main/java/com/facebook/ads/sdk/BlockedUserInfo.java @@ -62,9 +62,8 @@ public String getId() { public static BlockedUserInfo loadJSON(String json, APIContext context, String header) { BlockedUserInfo blockedUserInfo = getGson().fromJson(json, BlockedUserInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(blockedUserInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(blockedUserInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList blockedUserInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BrandRequest.java b/src/main/java/com/facebook/ads/sdk/BrandRequest.java index 309ad69c..b7676b93 100644 --- a/src/main/java/com/facebook/ads/sdk/BrandRequest.java +++ b/src/main/java/com/facebook/ads/sdk/BrandRequest.java @@ -153,9 +153,8 @@ public String getId() { public static BrandRequest loadJSON(String json, APIContext context, String header) { BrandRequest brandRequest = getGson().fromJson(json, BrandRequest.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(brandRequest.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(brandRequest.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -175,10 +174,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList brandRequests = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BrandSafetyBlockListUsage.java b/src/main/java/com/facebook/ads/sdk/BrandSafetyBlockListUsage.java index c59495fe..baee671e 100644 --- a/src/main/java/com/facebook/ads/sdk/BrandSafetyBlockListUsage.java +++ b/src/main/java/com/facebook/ads/sdk/BrandSafetyBlockListUsage.java @@ -62,9 +62,8 @@ public String getId() { public static BrandSafetyBlockListUsage loadJSON(String json, APIContext context, String header) { BrandSafetyBlockListUsage brandSafetyBlockListUsage = getGson().fromJson(json, BrandSafetyBlockListUsage.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(brandSafetyBlockListUsage.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(brandSafetyBlockListUsage.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APINodeList brandSafetyBlockListUsages = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BrandSafetyCampaignConfig.java b/src/main/java/com/facebook/ads/sdk/BrandSafetyCampaignConfig.java index 2ec4f871..2b6ffc15 100644 --- a/src/main/java/com/facebook/ads/sdk/BrandSafetyCampaignConfig.java +++ b/src/main/java/com/facebook/ads/sdk/BrandSafetyCampaignConfig.java @@ -54,9 +54,8 @@ public String getId() { public static BrandSafetyCampaignConfig loadJSON(String json, APIContext context, String header) { BrandSafetyCampaignConfig brandSafetyCampaignConfig = getGson().fromJson(json, BrandSafetyCampaignConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(brandSafetyCampaignConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(brandSafetyCampaignConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APINodeList brandSafetyCampaignConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BrandSafetyDownloadable.java b/src/main/java/com/facebook/ads/sdk/BrandSafetyDownloadable.java index bde78218..3ee88205 100644 --- a/src/main/java/com/facebook/ads/sdk/BrandSafetyDownloadable.java +++ b/src/main/java/com/facebook/ads/sdk/BrandSafetyDownloadable.java @@ -125,9 +125,8 @@ public String getId() { public static BrandSafetyDownloadable loadJSON(String json, APIContext context, String header) { BrandSafetyDownloadable brandSafetyDownloadable = getGson().fromJson(json, BrandSafetyDownloadable.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(brandSafetyDownloadable.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(brandSafetyDownloadable.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, AP APINodeList brandSafetyDownloadables = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BrandedContentAdError.java b/src/main/java/com/facebook/ads/sdk/BrandedContentAdError.java index 94c6da18..9cd553d6 100644 --- a/src/main/java/com/facebook/ads/sdk/BrandedContentAdError.java +++ b/src/main/java/com/facebook/ads/sdk/BrandedContentAdError.java @@ -66,9 +66,8 @@ public String getId() { public static BrandedContentAdError loadJSON(String json, APIContext context, String header) { BrandedContentAdError brandedContentAdError = getGson().fromJson(json, BrandedContentAdError.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(brandedContentAdError.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(brandedContentAdError.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList brandedContentAdErrors = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BrandedContentEligibleSponsorIDs.java b/src/main/java/com/facebook/ads/sdk/BrandedContentEligibleSponsorIDs.java index ea7f1539..c4f25bc5 100644 --- a/src/main/java/com/facebook/ads/sdk/BrandedContentEligibleSponsorIDs.java +++ b/src/main/java/com/facebook/ads/sdk/BrandedContentEligibleSponsorIDs.java @@ -58,9 +58,8 @@ public String getId() { public static BrandedContentEligibleSponsorIDs loadJSON(String json, APIContext context, String header) { BrandedContentEligibleSponsorIDs brandedContentEligibleSponsorIDs = getGson().fromJson(json, BrandedContentEligibleSponsorIDs.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(brandedContentEligibleSponsorIDs.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(brandedContentEligibleSponsorIDs.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String APINodeList brandedContentEligibleSponsorIDss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BrandedContentShadowIGMediaID.java b/src/main/java/com/facebook/ads/sdk/BrandedContentShadowIGMediaID.java index 891fadae..d8121ccb 100644 --- a/src/main/java/com/facebook/ads/sdk/BrandedContentShadowIGMediaID.java +++ b/src/main/java/com/facebook/ads/sdk/BrandedContentShadowIGMediaID.java @@ -62,9 +62,8 @@ public String getId() { public static BrandedContentShadowIGMediaID loadJSON(String json, APIContext context, String header) { BrandedContentShadowIGMediaID brandedContentShadowIGMediaID = getGson().fromJson(json, BrandedContentShadowIGMediaID.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(brandedContentShadowIGMediaID.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(brandedContentShadowIGMediaID.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String js APINodeList brandedContentShadowIGMediaIDs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BrandedContentShadowIGUserID.java b/src/main/java/com/facebook/ads/sdk/BrandedContentShadowIGUserID.java index f00c60e0..bf01ab7b 100644 --- a/src/main/java/com/facebook/ads/sdk/BrandedContentShadowIGUserID.java +++ b/src/main/java/com/facebook/ads/sdk/BrandedContentShadowIGUserID.java @@ -54,9 +54,8 @@ public String getId() { public static BrandedContentShadowIGUserID loadJSON(String json, APIContext context, String header) { BrandedContentShadowIGUserID brandedContentShadowIGUserID = getGson().fromJson(json, BrandedContentShadowIGUserID.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(brandedContentShadowIGUserID.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(brandedContentShadowIGUserID.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String jso APINodeList brandedContentShadowIGUserIDs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BroadTargetingCategories.java b/src/main/java/com/facebook/ads/sdk/BroadTargetingCategories.java index 364d49b6..be5dbed3 100644 --- a/src/main/java/com/facebook/ads/sdk/BroadTargetingCategories.java +++ b/src/main/java/com/facebook/ads/sdk/BroadTargetingCategories.java @@ -76,9 +76,8 @@ public String getId() { public static BroadTargetingCategories loadJSON(String json, APIContext context, String header) { BroadTargetingCategories broadTargetingCategories = getGson().fromJson(json, BroadTargetingCategories.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(broadTargetingCategories.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(broadTargetingCategories.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -98,10 +97,9 @@ public static APINodeList parseResponse(String json, A APINodeList broadTargetingCategoriess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Business.java b/src/main/java/com/facebook/ads/sdk/Business.java index 07262503..52f1b35b 100644 --- a/src/main/java/com/facebook/ads/sdk/Business.java +++ b/src/main/java/com/facebook/ads/sdk/Business.java @@ -155,9 +155,8 @@ public String getId() { public static Business loadJSON(String json, APIContext context, String header) { Business business = getGson().fromJson(json, Business.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(business.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(business.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -177,10 +176,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList businesss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessAdAccountRequest.java b/src/main/java/com/facebook/ads/sdk/BusinessAdAccountRequest.java index 041c2793..2c6889ee 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessAdAccountRequest.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessAdAccountRequest.java @@ -56,9 +56,8 @@ public String getId() { public static BusinessAdAccountRequest loadJSON(String json, APIContext context, String header) { BusinessAdAccountRequest businessAdAccountRequest = getGson().fromJson(json, BusinessAdAccountRequest.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessAdAccountRequest.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessAdAccountRequest.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, A APINodeList businessAdAccountRequests = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessAdsReportingReportSpecs.java b/src/main/java/com/facebook/ads/sdk/BusinessAdsReportingReportSpecs.java index 65d057d9..a20ae527 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessAdsReportingReportSpecs.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessAdsReportingReportSpecs.java @@ -130,9 +130,8 @@ public String getId() { public static BusinessAdsReportingReportSpecs loadJSON(String json, APIContext context, String header) { BusinessAdsReportingReportSpecs businessAdsReportingReportSpecs = getGson().fromJson(json, BusinessAdsReportingReportSpecs.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessAdsReportingReportSpecs.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessAdsReportingReportSpecs.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -152,10 +151,9 @@ public static APINodeList parseResponse(String APINodeList businessAdsReportingReportSpecss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessAdvertisableApplicationsResult.java b/src/main/java/com/facebook/ads/sdk/BusinessAdvertisableApplicationsResult.java index 90310658..ada12e16 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessAdvertisableApplicationsResult.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessAdvertisableApplicationsResult.java @@ -64,9 +64,8 @@ public String getId() { public static BusinessAdvertisableApplicationsResult loadJSON(String json, APIContext context, String header) { BusinessAdvertisableApplicationsResult businessAdvertisableApplicationsResult = getGson().fromJson(json, BusinessAdvertisableApplicationsResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessAdvertisableApplicationsResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessAdvertisableApplicationsResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse( APINodeList businessAdvertisableApplicationsResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessAgreement.java b/src/main/java/com/facebook/ads/sdk/BusinessAgreement.java index fd2f43f3..ac96f63e 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessAgreement.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessAgreement.java @@ -115,9 +115,8 @@ public String getId() { public static BusinessAgreement loadJSON(String json, APIContext context, String header) { BusinessAgreement businessAgreement = getGson().fromJson(json, BusinessAgreement.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessAgreement.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessAgreement.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList businessAgreements = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessApplicationRequest.java b/src/main/java/com/facebook/ads/sdk/BusinessApplicationRequest.java index 8b408416..6ef38d71 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessApplicationRequest.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessApplicationRequest.java @@ -56,9 +56,8 @@ public String getId() { public static BusinessApplicationRequest loadJSON(String json, APIContext context, String header) { BusinessApplicationRequest businessApplicationRequest = getGson().fromJson(json, BusinessApplicationRequest.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessApplicationRequest.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessApplicationRequest.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APINodeList businessApplicationRequests = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessAssetGroup.java b/src/main/java/com/facebook/ads/sdk/BusinessAssetGroup.java index ab5ad1c9..21227f2c 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessAssetGroup.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessAssetGroup.java @@ -117,9 +117,8 @@ public String getId() { public static BusinessAssetGroup loadJSON(String json, APIContext context, String header) { BusinessAssetGroup businessAssetGroup = getGson().fromJson(json, BusinessAssetGroup.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessAssetGroup.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessAssetGroup.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList businessAssetGroups = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessAssetSharingAgreement.java b/src/main/java/com/facebook/ads/sdk/BusinessAssetSharingAgreement.java index 4d276496..b9a5fa5f 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessAssetSharingAgreement.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessAssetSharingAgreement.java @@ -123,9 +123,8 @@ public String getId() { public static BusinessAssetSharingAgreement loadJSON(String json, APIContext context, String header) { BusinessAssetSharingAgreement businessAssetSharingAgreement = getGson().fromJson(json, BusinessAssetSharingAgreement.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessAssetSharingAgreement.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessAssetSharingAgreement.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String js APINodeList businessAssetSharingAgreements = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessCreative.java b/src/main/java/com/facebook/ads/sdk/BusinessCreative.java index 13ff6c59..d9b729a4 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessCreative.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessCreative.java @@ -74,9 +74,8 @@ public String getId() { public static BusinessCreative loadJSON(String json, APIContext context, String header) { BusinessCreative businessCreative = getGson().fromJson(json, BusinessCreative.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessCreative.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessCreative.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -96,10 +95,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList businessCreatives = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessCreativeFolder.java b/src/main/java/com/facebook/ads/sdk/BusinessCreativeFolder.java index 70a0bfe0..79e236ef 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessCreativeFolder.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessCreativeFolder.java @@ -127,9 +127,8 @@ public String getId() { public static BusinessCreativeFolder loadJSON(String json, APIContext context, String header) { BusinessCreativeFolder businessCreativeFolder = getGson().fromJson(json, BusinessCreativeFolder.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessCreativeFolder.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessCreativeFolder.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -149,10 +148,9 @@ public static APINodeList parseResponse(String json, API APINodeList businessCreativeFolders = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessCreativeInsights.java b/src/main/java/com/facebook/ads/sdk/BusinessCreativeInsights.java index aea74047..d879dec4 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessCreativeInsights.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessCreativeInsights.java @@ -84,9 +84,8 @@ public String getId() { public static BusinessCreativeInsights loadJSON(String json, APIContext context, String header) { BusinessCreativeInsights businessCreativeInsights = getGson().fromJson(json, BusinessCreativeInsights.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessCreativeInsights.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessCreativeInsights.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -106,10 +105,9 @@ public static APINodeList parseResponse(String json, A APINodeList businessCreativeInsightss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessFranchiseConfig.java b/src/main/java/com/facebook/ads/sdk/BusinessFranchiseConfig.java index 38b35415..989a0dd7 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessFranchiseConfig.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessFranchiseConfig.java @@ -137,9 +137,8 @@ public String getId() { public static BusinessFranchiseConfig loadJSON(String json, APIContext context, String header) { BusinessFranchiseConfig businessFranchiseConfig = getGson().fromJson(json, BusinessFranchiseConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessFranchiseConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessFranchiseConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -159,10 +158,9 @@ public static APINodeList parseResponse(String json, AP APINodeList businessFranchiseConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessImage.java b/src/main/java/com/facebook/ads/sdk/BusinessImage.java index 10821a42..73483f6f 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessImage.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessImage.java @@ -131,9 +131,8 @@ public String getId() { public static BusinessImage loadJSON(String json, APIContext context, String header) { BusinessImage businessImage = getGson().fromJson(json, BusinessImage.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessImage.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessImage.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -153,10 +152,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList businessImages = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessImageTBusinessFolderPathItem.java b/src/main/java/com/facebook/ads/sdk/BusinessImageTBusinessFolderPathItem.java index ca203a83..b6cfc613 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessImageTBusinessFolderPathItem.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessImageTBusinessFolderPathItem.java @@ -58,9 +58,8 @@ public String getId() { public static BusinessImageTBusinessFolderPathItem loadJSON(String json, APIContext context, String header) { BusinessImageTBusinessFolderPathItem businessImageTBusinessFolderPathItem = getGson().fromJson(json, BusinessImageTBusinessFolderPathItem.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessImageTBusinessFolderPathItem.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessImageTBusinessFolderPathItem.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(St APINodeList businessImageTBusinessFolderPathItems = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessManagedPartnerEligibility.java b/src/main/java/com/facebook/ads/sdk/BusinessManagedPartnerEligibility.java index 19bc98b2..2be1019d 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessManagedPartnerEligibility.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessManagedPartnerEligibility.java @@ -58,9 +58,8 @@ public String getId() { public static BusinessManagedPartnerEligibility loadJSON(String json, APIContext context, String header) { BusinessManagedPartnerEligibility businessManagedPartnerEligibility = getGson().fromJson(json, BusinessManagedPartnerEligibility.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessManagedPartnerEligibility.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessManagedPartnerEligibility.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(Strin APINodeList businessManagedPartnerEligibilitys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessMediaAdPlacementValidationResult.java b/src/main/java/com/facebook/ads/sdk/BusinessMediaAdPlacementValidationResult.java index f86b0207..e95020de 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessMediaAdPlacementValidationResult.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessMediaAdPlacementValidationResult.java @@ -60,9 +60,8 @@ public String getId() { public static BusinessMediaAdPlacementValidationResult loadJSON(String json, APIContext context, String header) { BusinessMediaAdPlacementValidationResult businessMediaAdPlacementValidationResult = getGson().fromJson(json, BusinessMediaAdPlacementValidationResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessMediaAdPlacementValidationResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessMediaAdPlacementValidationResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseRespons APINodeList businessMediaAdPlacementValidationResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessObject.java b/src/main/java/com/facebook/ads/sdk/BusinessObject.java index 59e32e1d..412635d8 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessObject.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessObject.java @@ -62,9 +62,8 @@ public String getId() { public static BusinessObject loadJSON(String json, APIContext context, String header) { BusinessObject businessObject = getGson().fromJson(json, BusinessObject.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessObject.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessObject.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList businessObjects = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessObjectTransferOwnershipAgreement.java b/src/main/java/com/facebook/ads/sdk/BusinessObjectTransferOwnershipAgreement.java index fa3b6911..2165fb64 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessObjectTransferOwnershipAgreement.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessObjectTransferOwnershipAgreement.java @@ -119,9 +119,8 @@ public String getId() { public static BusinessObjectTransferOwnershipAgreement loadJSON(String json, APIContext context, String header) { BusinessObjectTransferOwnershipAgreement businessObjectTransferOwnershipAgreement = getGson().fromJson(json, BusinessObjectTransferOwnershipAgreement.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessObjectTransferOwnershipAgreement.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessObjectTransferOwnershipAgreement.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseRespons APINodeList businessObjectTransferOwnershipAgreements = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessOwnedObjectOnBehalfOfRequest.java b/src/main/java/com/facebook/ads/sdk/BusinessOwnedObjectOnBehalfOfRequest.java index f49c1ef7..ffded84e 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessOwnedObjectOnBehalfOfRequest.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessOwnedObjectOnBehalfOfRequest.java @@ -121,9 +121,8 @@ public String getId() { public static BusinessOwnedObjectOnBehalfOfRequest loadJSON(String json, APIContext context, String header) { BusinessOwnedObjectOnBehalfOfRequest businessOwnedObjectOnBehalfOfRequest = getGson().fromJson(json, BusinessOwnedObjectOnBehalfOfRequest.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessOwnedObjectOnBehalfOfRequest.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessOwnedObjectOnBehalfOfRequest.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(St APINodeList businessOwnedObjectOnBehalfOfRequests = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessPageRequest.java b/src/main/java/com/facebook/ads/sdk/BusinessPageRequest.java index bd2b5914..08b50e25 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessPageRequest.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessPageRequest.java @@ -56,9 +56,8 @@ public String getId() { public static BusinessPageRequest loadJSON(String json, APIContext context, String header) { BusinessPageRequest businessPageRequest = getGson().fromJson(json, BusinessPageRequest.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessPageRequest.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessPageRequest.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList businessPageRequests = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessPartnerPremiumOptions.java b/src/main/java/com/facebook/ads/sdk/BusinessPartnerPremiumOptions.java index c57ffb44..b3ddcb3f 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessPartnerPremiumOptions.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessPartnerPremiumOptions.java @@ -58,9 +58,8 @@ public String getId() { public static BusinessPartnerPremiumOptions loadJSON(String json, APIContext context, String header) { BusinessPartnerPremiumOptions businessPartnerPremiumOptions = getGson().fromJson(json, BusinessPartnerPremiumOptions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessPartnerPremiumOptions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessPartnerPremiumOptions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String js APINodeList businessPartnerPremiumOptionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessProductCatalogTOS.java b/src/main/java/com/facebook/ads/sdk/BusinessProductCatalogTOS.java index 39a4caad..49b564bf 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessProductCatalogTOS.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessProductCatalogTOS.java @@ -56,9 +56,8 @@ public String getId() { public static BusinessProductCatalogTOS loadJSON(String json, APIContext context, String header) { BusinessProductCatalogTOS businessProductCatalogTOS = getGson().fromJson(json, BusinessProductCatalogTOS.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessProductCatalogTOS.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessProductCatalogTOS.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APINodeList businessProductCatalogTOSs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessProject.java b/src/main/java/com/facebook/ads/sdk/BusinessProject.java index 27ac062f..d7c05377 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessProject.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessProject.java @@ -121,9 +121,8 @@ public String getId() { public static BusinessProject loadJSON(String json, APIContext context, String header) { BusinessProject businessProject = getGson().fromJson(json, BusinessProject.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessProject.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessProject.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList businessProjects = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessRequest.java b/src/main/java/com/facebook/ads/sdk/BusinessRequest.java index fc490b90..c18003b7 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessRequest.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessRequest.java @@ -129,9 +129,8 @@ public String getId() { public static BusinessRequest loadJSON(String json, APIContext context, String header) { BusinessRequest businessRequest = getGson().fromJson(json, BusinessRequest.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessRequest.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessRequest.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList businessRequests = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessRoleRequest.java b/src/main/java/com/facebook/ads/sdk/BusinessRoleRequest.java index 5e2eba0b..3ca0724c 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessRoleRequest.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessRoleRequest.java @@ -141,9 +141,8 @@ public String getId() { public static BusinessRoleRequest loadJSON(String json, APIContext context, String header) { BusinessRoleRequest businessRoleRequest = getGson().fromJson(json, BusinessRoleRequest.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessRoleRequest.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessRoleRequest.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -163,10 +162,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList businessRoleRequests = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessSettingLogsData.java b/src/main/java/com/facebook/ads/sdk/BusinessSettingLogsData.java index 4e7ce39c..35d49a3d 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessSettingLogsData.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessSettingLogsData.java @@ -62,9 +62,8 @@ public String getId() { public static BusinessSettingLogsData loadJSON(String json, APIContext context, String header) { BusinessSettingLogsData businessSettingLogsData = getGson().fromJson(json, BusinessSettingLogsData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessSettingLogsData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessSettingLogsData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, AP APINodeList businessSettingLogsDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessTag.java b/src/main/java/com/facebook/ads/sdk/BusinessTag.java index 9d6115ea..11a18ede 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessTag.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessTag.java @@ -115,9 +115,8 @@ public String getId() { public static BusinessTag loadJSON(String json, APIContext context, String header) { BusinessTag businessTag = getGson().fromJson(json, BusinessTag.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessTag.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessTag.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList businessTags = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessTrafficAnalysisReport.java b/src/main/java/com/facebook/ads/sdk/BusinessTrafficAnalysisReport.java index 5e07142d..a8c0ad89 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessTrafficAnalysisReport.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessTrafficAnalysisReport.java @@ -58,9 +58,8 @@ public String getId() { public static BusinessTrafficAnalysisReport loadJSON(String json, APIContext context, String header) { BusinessTrafficAnalysisReport businessTrafficAnalysisReport = getGson().fromJson(json, BusinessTrafficAnalysisReport.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessTrafficAnalysisReport.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessTrafficAnalysisReport.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String js APINodeList businessTrafficAnalysisReports = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessUser.java b/src/main/java/com/facebook/ads/sdk/BusinessUser.java index 03cc3a03..785004d4 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessUser.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessUser.java @@ -139,9 +139,8 @@ public String getId() { public static BusinessUser loadJSON(String json, APIContext context, String header) { BusinessUser businessUser = getGson().fromJson(json, BusinessUser.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessUser.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessUser.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -161,10 +160,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList businessUsers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessVideo.java b/src/main/java/com/facebook/ads/sdk/BusinessVideo.java index 8559799b..9caff548 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessVideo.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessVideo.java @@ -121,9 +121,8 @@ public String getId() { public static BusinessVideo loadJSON(String json, APIContext context, String header) { BusinessVideo businessVideo = getGson().fromJson(json, BusinessVideo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessVideo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessVideo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList businessVideos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/BusinessVideoTBusinessFolderPathItem.java b/src/main/java/com/facebook/ads/sdk/BusinessVideoTBusinessFolderPathItem.java index 0f2aeea1..aefcc9ce 100644 --- a/src/main/java/com/facebook/ads/sdk/BusinessVideoTBusinessFolderPathItem.java +++ b/src/main/java/com/facebook/ads/sdk/BusinessVideoTBusinessFolderPathItem.java @@ -58,9 +58,8 @@ public String getId() { public static BusinessVideoTBusinessFolderPathItem loadJSON(String json, APIContext context, String header) { BusinessVideoTBusinessFolderPathItem businessVideoTBusinessFolderPathItem = getGson().fromJson(json, BusinessVideoTBusinessFolderPathItem.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(businessVideoTBusinessFolderPathItem.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(businessVideoTBusinessFolderPathItem.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(St APINodeList businessVideoTBusinessFolderPathItems = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CASSSetupOfflineEventSetProgress.java b/src/main/java/com/facebook/ads/sdk/CASSSetupOfflineEventSetProgress.java index 23adbbb3..f17723ab 100644 --- a/src/main/java/com/facebook/ads/sdk/CASSSetupOfflineEventSetProgress.java +++ b/src/main/java/com/facebook/ads/sdk/CASSSetupOfflineEventSetProgress.java @@ -52,9 +52,8 @@ public String getId() { public static CASSSetupOfflineEventSetProgress loadJSON(String json, APIContext context, String header) { CASSSetupOfflineEventSetProgress cassSetupOfflineEventSetProgress = getGson().fromJson(json, CASSSetupOfflineEventSetProgress.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(cassSetupOfflineEventSetProgress.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(cassSetupOfflineEventSetProgress.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseResponse(String APINodeList cassSetupOfflineEventSetProgresss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CPASAdCreationTemplate.java b/src/main/java/com/facebook/ads/sdk/CPASAdCreationTemplate.java index 563b9fd8..7fdc2a7d 100644 --- a/src/main/java/com/facebook/ads/sdk/CPASAdCreationTemplate.java +++ b/src/main/java/com/facebook/ads/sdk/CPASAdCreationTemplate.java @@ -125,9 +125,8 @@ public String getId() { public static CPASAdCreationTemplate loadJSON(String json, APIContext context, String header) { CPASAdCreationTemplate cpasAdCreationTemplate = getGson().fromJson(json, CPASAdCreationTemplate.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(cpasAdCreationTemplate.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(cpasAdCreationTemplate.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, API APINodeList cpasAdCreationTemplates = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CPASAdvertiserPartnershipRecommendation.java b/src/main/java/com/facebook/ads/sdk/CPASAdvertiserPartnershipRecommendation.java index 2e0bd487..598735a4 100644 --- a/src/main/java/com/facebook/ads/sdk/CPASAdvertiserPartnershipRecommendation.java +++ b/src/main/java/com/facebook/ads/sdk/CPASAdvertiserPartnershipRecommendation.java @@ -129,9 +129,8 @@ public String getId() { public static CPASAdvertiserPartnershipRecommendation loadJSON(String json, APIContext context, String header) { CPASAdvertiserPartnershipRecommendation cpasAdvertiserPartnershipRecommendation = getGson().fromJson(json, CPASAdvertiserPartnershipRecommendation.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(cpasAdvertiserPartnershipRecommendation.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(cpasAdvertiserPartnershipRecommendation.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse APINodeList cpasAdvertiserPartnershipRecommendations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CPASBusinessSetupConfig.java b/src/main/java/com/facebook/ads/sdk/CPASBusinessSetupConfig.java index 462691a8..01c715ca 100644 --- a/src/main/java/com/facebook/ads/sdk/CPASBusinessSetupConfig.java +++ b/src/main/java/com/facebook/ads/sdk/CPASBusinessSetupConfig.java @@ -121,9 +121,8 @@ public String getId() { public static CPASBusinessSetupConfig loadJSON(String json, APIContext context, String header) { CPASBusinessSetupConfig cpasBusinessSetupConfig = getGson().fromJson(json, CPASBusinessSetupConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(cpasBusinessSetupConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(cpasBusinessSetupConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String json, AP APINodeList cpasBusinessSetupConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CPASCollaborationRequest.java b/src/main/java/com/facebook/ads/sdk/CPASCollaborationRequest.java index 66680fe1..fda54e74 100644 --- a/src/main/java/com/facebook/ads/sdk/CPASCollaborationRequest.java +++ b/src/main/java/com/facebook/ads/sdk/CPASCollaborationRequest.java @@ -131,9 +131,8 @@ public String getId() { public static CPASCollaborationRequest loadJSON(String json, APIContext context, String header) { CPASCollaborationRequest cpasCollaborationRequest = getGson().fromJson(json, CPASCollaborationRequest.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(cpasCollaborationRequest.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(cpasCollaborationRequest.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -153,10 +152,9 @@ public static APINodeList parseResponse(String json, A APINodeList cpasCollaborationRequests = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CPASLsbImageBank.java b/src/main/java/com/facebook/ads/sdk/CPASLsbImageBank.java index 66cf8732..b73ad0f4 100644 --- a/src/main/java/com/facebook/ads/sdk/CPASLsbImageBank.java +++ b/src/main/java/com/facebook/ads/sdk/CPASLsbImageBank.java @@ -117,9 +117,8 @@ public String getId() { public static CPASLsbImageBank loadJSON(String json, APIContext context, String header) { CPASLsbImageBank cpasLsbImageBank = getGson().fromJson(json, CPASLsbImageBank.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(cpasLsbImageBank.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(cpasLsbImageBank.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList cpasLsbImageBanks = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CPASMerchantConfig.java b/src/main/java/com/facebook/ads/sdk/CPASMerchantConfig.java index 1457b31b..c0f7e7c7 100644 --- a/src/main/java/com/facebook/ads/sdk/CPASMerchantConfig.java +++ b/src/main/java/com/facebook/ads/sdk/CPASMerchantConfig.java @@ -125,9 +125,8 @@ public String getId() { public static CPASMerchantConfig loadJSON(String json, APIContext context, String header) { CPASMerchantConfig cpasMerchantConfig = getGson().fromJson(json, CPASMerchantConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(cpasMerchantConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(cpasMerchantConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList cpasMerchantConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CPASParentCatalogSettings.java b/src/main/java/com/facebook/ads/sdk/CPASParentCatalogSettings.java index eb76e50a..998565c8 100644 --- a/src/main/java/com/facebook/ads/sdk/CPASParentCatalogSettings.java +++ b/src/main/java/com/facebook/ads/sdk/CPASParentCatalogSettings.java @@ -119,9 +119,8 @@ public String getId() { public static CPASParentCatalogSettings loadJSON(String json, APIContext context, String header) { CPASParentCatalogSettings cpasParentCatalogSettings = getGson().fromJson(json, CPASParentCatalogSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(cpasParentCatalogSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(cpasParentCatalogSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, APINodeList cpasParentCatalogSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CPASSetup.java b/src/main/java/com/facebook/ads/sdk/CPASSetup.java index 1aa68839..84d94940 100644 --- a/src/main/java/com/facebook/ads/sdk/CPASSetup.java +++ b/src/main/java/com/facebook/ads/sdk/CPASSetup.java @@ -52,9 +52,8 @@ public String getId() { public static CPASSetup loadJSON(String json, APIContext context, String header) { CPASSetup cpasSetup = getGson().fromJson(json, CPASSetup.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(cpasSetup.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(cpasSetup.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseResponse(String json, APIContext conte APINodeList cpasSetups = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CPASSetupPageStructureProgress.java b/src/main/java/com/facebook/ads/sdk/CPASSetupPageStructureProgress.java index a9138f0a..76a9a681 100644 --- a/src/main/java/com/facebook/ads/sdk/CPASSetupPageStructureProgress.java +++ b/src/main/java/com/facebook/ads/sdk/CPASSetupPageStructureProgress.java @@ -58,9 +58,8 @@ public String getId() { public static CPASSetupPageStructureProgress loadJSON(String json, APIContext context, String header) { CPASSetupPageStructureProgress cpasSetupPageStructureProgress = getGson().fromJson(json, CPASSetupPageStructureProgress.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(cpasSetupPageStructureProgress.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(cpasSetupPageStructureProgress.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String j APINodeList cpasSetupPageStructureProgresss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CRMAddress.java b/src/main/java/com/facebook/ads/sdk/CRMAddress.java index abab14af..12319279 100644 --- a/src/main/java/com/facebook/ads/sdk/CRMAddress.java +++ b/src/main/java/com/facebook/ads/sdk/CRMAddress.java @@ -139,9 +139,8 @@ public String getId() { public static CRMAddress loadJSON(String json, APIContext context, String header) { CRMAddress crmAddress = getGson().fromJson(json, CRMAddress.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(crmAddress.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(crmAddress.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -161,10 +160,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList crmAddresss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CTWAWhatsAppNumbersInfo.java b/src/main/java/com/facebook/ads/sdk/CTWAWhatsAppNumbersInfo.java index c3e5f137..eab5f7f5 100644 --- a/src/main/java/com/facebook/ads/sdk/CTWAWhatsAppNumbersInfo.java +++ b/src/main/java/com/facebook/ads/sdk/CTWAWhatsAppNumbersInfo.java @@ -68,9 +68,8 @@ public String getId() { public static CTWAWhatsAppNumbersInfo loadJSON(String json, APIContext context, String header) { CTWAWhatsAppNumbersInfo ctwaWhatsAppNumbersInfo = getGson().fromJson(json, CTWAWhatsAppNumbersInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(ctwaWhatsAppNumbersInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(ctwaWhatsAppNumbersInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String json, AP APINodeList ctwaWhatsAppNumbersInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CTXOptimizationEligibility.java b/src/main/java/com/facebook/ads/sdk/CTXOptimizationEligibility.java index f8d6e090..ab0e0dd0 100644 --- a/src/main/java/com/facebook/ads/sdk/CTXOptimizationEligibility.java +++ b/src/main/java/com/facebook/ads/sdk/CTXOptimizationEligibility.java @@ -54,9 +54,8 @@ public String getId() { public static CTXOptimizationEligibility loadJSON(String json, APIContext context, String header) { CTXOptimizationEligibility ctxOptimizationEligibility = getGson().fromJson(json, CTXOptimizationEligibility.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(ctxOptimizationEligibility.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(ctxOptimizationEligibility.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APINodeList ctxOptimizationEligibilitys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CTXPartnerAppWelcomeMessageFlow.java b/src/main/java/com/facebook/ads/sdk/CTXPartnerAppWelcomeMessageFlow.java index 3cf1dd44..c28fef07 100644 --- a/src/main/java/com/facebook/ads/sdk/CTXPartnerAppWelcomeMessageFlow.java +++ b/src/main/java/com/facebook/ads/sdk/CTXPartnerAppWelcomeMessageFlow.java @@ -129,9 +129,8 @@ public String getId() { public static CTXPartnerAppWelcomeMessageFlow loadJSON(String json, APIContext context, String header) { CTXPartnerAppWelcomeMessageFlow ctxPartnerAppWelcomeMessageFlow = getGson().fromJson(json, CTXPartnerAppWelcomeMessageFlow.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(ctxPartnerAppWelcomeMessageFlow.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(ctxPartnerAppWelcomeMessageFlow.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse(String APINodeList ctxPartnerAppWelcomeMessageFlows = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CalibratorExistingRule.java b/src/main/java/com/facebook/ads/sdk/CalibratorExistingRule.java index 5f267175..fabcc4cb 100644 --- a/src/main/java/com/facebook/ads/sdk/CalibratorExistingRule.java +++ b/src/main/java/com/facebook/ads/sdk/CalibratorExistingRule.java @@ -133,9 +133,8 @@ public String getId() { public static CalibratorExistingRule loadJSON(String json, APIContext context, String header) { CalibratorExistingRule calibratorExistingRule = getGson().fromJson(json, CalibratorExistingRule.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(calibratorExistingRule.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(calibratorExistingRule.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -155,10 +154,9 @@ public static APINodeList parseResponse(String json, API APINodeList calibratorExistingRules = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CallAdsPhoneData.java b/src/main/java/com/facebook/ads/sdk/CallAdsPhoneData.java index 2dd95ec6..6587cfbc 100644 --- a/src/main/java/com/facebook/ads/sdk/CallAdsPhoneData.java +++ b/src/main/java/com/facebook/ads/sdk/CallAdsPhoneData.java @@ -123,9 +123,8 @@ public String getId() { public static CallAdsPhoneData loadJSON(String json, APIContext context, String header) { CallAdsPhoneData callAdsPhoneData = getGson().fromJson(json, CallAdsPhoneData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(callAdsPhoneData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(callAdsPhoneData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList callAdsPhoneDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Campaign.java b/src/main/java/com/facebook/ads/sdk/Campaign.java index f9e21f96..35aae0ac 100644 --- a/src/main/java/com/facebook/ads/sdk/Campaign.java +++ b/src/main/java/com/facebook/ads/sdk/Campaign.java @@ -193,9 +193,8 @@ public String getId() { public static Campaign loadJSON(String json, APIContext context, String header) { Campaign campaign = getGson().fromJson(json, Campaign.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(campaign.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(campaign.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -215,10 +214,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList campaigns = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CampaignActionsData.java b/src/main/java/com/facebook/ads/sdk/CampaignActionsData.java index 7eb69030..641279c9 100644 --- a/src/main/java/com/facebook/ads/sdk/CampaignActionsData.java +++ b/src/main/java/com/facebook/ads/sdk/CampaignActionsData.java @@ -52,9 +52,8 @@ public String getId() { public static CampaignActionsData loadJSON(String json, APIContext context, String header) { CampaignActionsData campaignActionsData = getGson().fromJson(json, CampaignActionsData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(campaignActionsData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(campaignActionsData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList campaignActionsDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CampaignGroupBrandConfiguration.java b/src/main/java/com/facebook/ads/sdk/CampaignGroupBrandConfiguration.java index 5788c928..38794930 100644 --- a/src/main/java/com/facebook/ads/sdk/CampaignGroupBrandConfiguration.java +++ b/src/main/java/com/facebook/ads/sdk/CampaignGroupBrandConfiguration.java @@ -58,9 +58,8 @@ public String getId() { public static CampaignGroupBrandConfiguration loadJSON(String json, APIContext context, String header) { CampaignGroupBrandConfiguration campaignGroupBrandConfiguration = getGson().fromJson(json, CampaignGroupBrandConfiguration.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(campaignGroupBrandConfiguration.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(campaignGroupBrandConfiguration.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String APINodeList campaignGroupBrandConfigurations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CampaignGroupCollaborativeAdsPartnerInfo.java b/src/main/java/com/facebook/ads/sdk/CampaignGroupCollaborativeAdsPartnerInfo.java index a0d5df9d..dd7f9458 100644 --- a/src/main/java/com/facebook/ads/sdk/CampaignGroupCollaborativeAdsPartnerInfo.java +++ b/src/main/java/com/facebook/ads/sdk/CampaignGroupCollaborativeAdsPartnerInfo.java @@ -52,9 +52,8 @@ public String getId() { public static CampaignGroupCollaborativeAdsPartnerInfo loadJSON(String json, APIContext context, String header) { CampaignGroupCollaborativeAdsPartnerInfo campaignGroupCollaborativeAdsPartnerInfo = getGson().fromJson(json, CampaignGroupCollaborativeAdsPartnerInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(campaignGroupCollaborativeAdsPartnerInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(campaignGroupCollaborativeAdsPartnerInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseRespons APINodeList campaignGroupCollaborativeAdsPartnerInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Canvas.java b/src/main/java/com/facebook/ads/sdk/Canvas.java index 603fe8a2..11891e11 100644 --- a/src/main/java/com/facebook/ads/sdk/Canvas.java +++ b/src/main/java/com/facebook/ads/sdk/Canvas.java @@ -165,9 +165,8 @@ public String getId() { public static Canvas loadJSON(String json, APIContext context, String header) { Canvas canvas = getGson().fromJson(json, Canvas.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(canvas.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(canvas.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -187,10 +186,9 @@ public static APINodeList parseResponse(String json, APIContext context, APINodeList canvass = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CanvasAdSettings.java b/src/main/java/com/facebook/ads/sdk/CanvasAdSettings.java index 7f4ba0c5..7c0f082a 100644 --- a/src/main/java/com/facebook/ads/sdk/CanvasAdSettings.java +++ b/src/main/java/com/facebook/ads/sdk/CanvasAdSettings.java @@ -66,9 +66,8 @@ public String getId() { public static CanvasAdSettings loadJSON(String json, APIContext context, String header) { CanvasAdSettings canvasAdSettings = getGson().fromJson(json, CanvasAdSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(canvasAdSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(canvasAdSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList canvasAdSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CanvasBodyElement.java b/src/main/java/com/facebook/ads/sdk/CanvasBodyElement.java index 7a884c82..9c7a70ee 100644 --- a/src/main/java/com/facebook/ads/sdk/CanvasBodyElement.java +++ b/src/main/java/com/facebook/ads/sdk/CanvasBodyElement.java @@ -54,9 +54,8 @@ public String getId() { public static CanvasBodyElement loadJSON(String json, APIContext context, String header) { CanvasBodyElement canvasBodyElement = getGson().fromJson(json, CanvasBodyElement.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(canvasBodyElement.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(canvasBodyElement.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList canvasBodyElements = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CanvasCollectionThumbnail.java b/src/main/java/com/facebook/ads/sdk/CanvasCollectionThumbnail.java index 1c31e687..8489f72a 100644 --- a/src/main/java/com/facebook/ads/sdk/CanvasCollectionThumbnail.java +++ b/src/main/java/com/facebook/ads/sdk/CanvasCollectionThumbnail.java @@ -58,9 +58,8 @@ public String getId() { public static CanvasCollectionThumbnail loadJSON(String json, APIContext context, String header) { CanvasCollectionThumbnail canvasCollectionThumbnail = getGson().fromJson(json, CanvasCollectionThumbnail.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(canvasCollectionThumbnail.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(canvasCollectionThumbnail.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APINodeList canvasCollectionThumbnails = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CanvasDynamicSetting.java b/src/main/java/com/facebook/ads/sdk/CanvasDynamicSetting.java index 2f9a5fee..6f075d19 100644 --- a/src/main/java/com/facebook/ads/sdk/CanvasDynamicSetting.java +++ b/src/main/java/com/facebook/ads/sdk/CanvasDynamicSetting.java @@ -117,9 +117,8 @@ public String getId() { public static CanvasDynamicSetting loadJSON(String json, APIContext context, String header) { CanvasDynamicSetting canvasDynamicSetting = getGson().fromJson(json, CanvasDynamicSetting.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(canvasDynamicSetting.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(canvasDynamicSetting.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList canvasDynamicSettings = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CanvasPreview.java b/src/main/java/com/facebook/ads/sdk/CanvasPreview.java index fc171bf9..36eefe85 100644 --- a/src/main/java/com/facebook/ads/sdk/CanvasPreview.java +++ b/src/main/java/com/facebook/ads/sdk/CanvasPreview.java @@ -54,9 +54,8 @@ public String getId() { public static CanvasPreview loadJSON(String json, APIContext context, String header) { CanvasPreview canvasPreview = getGson().fromJson(json, CanvasPreview.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(canvasPreview.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(canvasPreview.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList canvasPreviews = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CanvasTemplate.java b/src/main/java/com/facebook/ads/sdk/CanvasTemplate.java index 5178e774..85b34caa 100644 --- a/src/main/java/com/facebook/ads/sdk/CanvasTemplate.java +++ b/src/main/java/com/facebook/ads/sdk/CanvasTemplate.java @@ -139,9 +139,8 @@ public String getId() { public static CanvasTemplate loadJSON(String json, APIContext context, String header) { CanvasTemplate canvasTemplate = getGson().fromJson(json, CanvasTemplate.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(canvasTemplate.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(canvasTemplate.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -161,10 +160,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList canvasTemplates = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CatalogBasedTargeting.java b/src/main/java/com/facebook/ads/sdk/CatalogBasedTargeting.java index 5ace816a..023fc756 100644 --- a/src/main/java/com/facebook/ads/sdk/CatalogBasedTargeting.java +++ b/src/main/java/com/facebook/ads/sdk/CatalogBasedTargeting.java @@ -54,9 +54,8 @@ public String getId() { public static CatalogBasedTargeting loadJSON(String json, APIContext context, String header) { CatalogBasedTargeting catalogBasedTargeting = getGson().fromJson(json, CatalogBasedTargeting.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(catalogBasedTargeting.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(catalogBasedTargeting.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList catalogBasedTargetings = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CatalogItemAppLinks.java b/src/main/java/com/facebook/ads/sdk/CatalogItemAppLinks.java index a7f1c262..5c7f1c1a 100644 --- a/src/main/java/com/facebook/ads/sdk/CatalogItemAppLinks.java +++ b/src/main/java/com/facebook/ads/sdk/CatalogItemAppLinks.java @@ -68,9 +68,8 @@ public String getId() { public static CatalogItemAppLinks loadJSON(String json, APIContext context, String header) { CatalogItemAppLinks catalogItemAppLinks = getGson().fromJson(json, CatalogItemAppLinks.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(catalogItemAppLinks.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(catalogItemAppLinks.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList catalogItemAppLinkss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CatalogItemChannelsToIntegrityStatus.java b/src/main/java/com/facebook/ads/sdk/CatalogItemChannelsToIntegrityStatus.java index ebf3d433..189b117b 100644 --- a/src/main/java/com/facebook/ads/sdk/CatalogItemChannelsToIntegrityStatus.java +++ b/src/main/java/com/facebook/ads/sdk/CatalogItemChannelsToIntegrityStatus.java @@ -56,9 +56,8 @@ public String getId() { public static CatalogItemChannelsToIntegrityStatus loadJSON(String json, APIContext context, String header) { CatalogItemChannelsToIntegrityStatus catalogItemChannelsToIntegrityStatus = getGson().fromJson(json, CatalogItemChannelsToIntegrityStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(catalogItemChannelsToIntegrityStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(catalogItemChannelsToIntegrityStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(St APINodeList catalogItemChannelsToIntegrityStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CatalogItemOverride.java b/src/main/java/com/facebook/ads/sdk/CatalogItemOverride.java index 7aeba860..1e7d1be9 100644 --- a/src/main/java/com/facebook/ads/sdk/CatalogItemOverride.java +++ b/src/main/java/com/facebook/ads/sdk/CatalogItemOverride.java @@ -119,9 +119,8 @@ public String getId() { public static CatalogItemOverride loadJSON(String json, APIContext context, String header) { CatalogItemOverride catalogItemOverride = getGson().fromJson(json, CatalogItemOverride.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(catalogItemOverride.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(catalogItemOverride.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList catalogItemOverrides = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CatalogItemRejectionReasons.java b/src/main/java/com/facebook/ads/sdk/CatalogItemRejectionReasons.java index e54b00ff..200cda99 100644 --- a/src/main/java/com/facebook/ads/sdk/CatalogItemRejectionReasons.java +++ b/src/main/java/com/facebook/ads/sdk/CatalogItemRejectionReasons.java @@ -56,9 +56,8 @@ public String getId() { public static CatalogItemRejectionReasons loadJSON(String json, APIContext context, String header) { CatalogItemRejectionReasons catalogItemRejectionReasons = getGson().fromJson(json, CatalogItemRejectionReasons.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(catalogItemRejectionReasons.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(catalogItemRejectionReasons.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json APINodeList catalogItemRejectionReasonss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CatalogItemValidationErrorList.java b/src/main/java/com/facebook/ads/sdk/CatalogItemValidationErrorList.java index bebad222..de298142 100644 --- a/src/main/java/com/facebook/ads/sdk/CatalogItemValidationErrorList.java +++ b/src/main/java/com/facebook/ads/sdk/CatalogItemValidationErrorList.java @@ -54,9 +54,8 @@ public String getId() { public static CatalogItemValidationErrorList loadJSON(String json, APIContext context, String header) { CatalogItemValidationErrorList catalogItemValidationErrorList = getGson().fromJson(json, CatalogItemValidationErrorList.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(catalogItemValidationErrorList.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(catalogItemValidationErrorList.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String j APINodeList catalogItemValidationErrorLists = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CatalogSmartPixelSettings.java b/src/main/java/com/facebook/ads/sdk/CatalogSmartPixelSettings.java index 9fff086b..7650da37 100644 --- a/src/main/java/com/facebook/ads/sdk/CatalogSmartPixelSettings.java +++ b/src/main/java/com/facebook/ads/sdk/CatalogSmartPixelSettings.java @@ -143,9 +143,8 @@ public String getId() { public static CatalogSmartPixelSettings loadJSON(String json, APIContext context, String header) { CatalogSmartPixelSettings catalogSmartPixelSettings = getGson().fromJson(json, CatalogSmartPixelSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(catalogSmartPixelSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(catalogSmartPixelSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -165,10 +164,9 @@ public static APINodeList parseResponse(String json, APINodeList catalogSmartPixelSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CatalogSubVerticalList.java b/src/main/java/com/facebook/ads/sdk/CatalogSubVerticalList.java index c1c2b0cb..4ed76f11 100644 --- a/src/main/java/com/facebook/ads/sdk/CatalogSubVerticalList.java +++ b/src/main/java/com/facebook/ads/sdk/CatalogSubVerticalList.java @@ -158,9 +158,8 @@ public String getId() { public static CatalogSubVerticalList loadJSON(String json, APIContext context, String header) { CatalogSubVerticalList catalogSubVerticalList = getGson().fromJson(json, CatalogSubVerticalList.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(catalogSubVerticalList.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(catalogSubVerticalList.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -180,10 +179,9 @@ public static APINodeList parseResponse(String json, API APINodeList catalogSubVerticalLists = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CatalogWebsiteOnboardingSettings.java b/src/main/java/com/facebook/ads/sdk/CatalogWebsiteOnboardingSettings.java index 61565540..6d13f0ed 100644 --- a/src/main/java/com/facebook/ads/sdk/CatalogWebsiteOnboardingSettings.java +++ b/src/main/java/com/facebook/ads/sdk/CatalogWebsiteOnboardingSettings.java @@ -115,9 +115,8 @@ public String getId() { public static CatalogWebsiteOnboardingSettings loadJSON(String json, APIContext context, String header) { CatalogWebsiteOnboardingSettings catalogWebsiteOnboardingSettings = getGson().fromJson(json, CatalogWebsiteOnboardingSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(catalogWebsiteOnboardingSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(catalogWebsiteOnboardingSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String APINodeList catalogWebsiteOnboardingSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CatalogWebsiteSettings.java b/src/main/java/com/facebook/ads/sdk/CatalogWebsiteSettings.java index ab6c2490..f35a7811 100644 --- a/src/main/java/com/facebook/ads/sdk/CatalogWebsiteSettings.java +++ b/src/main/java/com/facebook/ads/sdk/CatalogWebsiteSettings.java @@ -115,9 +115,8 @@ public String getId() { public static CatalogWebsiteSettings loadJSON(String json, APIContext context, String header) { CatalogWebsiteSettings catalogWebsiteSettings = getGson().fromJson(json, CatalogWebsiteSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(catalogWebsiteSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(catalogWebsiteSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, API APINodeList catalogWebsiteSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ChatPlugin.java b/src/main/java/com/facebook/ads/sdk/ChatPlugin.java index 8e0101b7..19fda213 100644 --- a/src/main/java/com/facebook/ads/sdk/ChatPlugin.java +++ b/src/main/java/com/facebook/ads/sdk/ChatPlugin.java @@ -76,9 +76,8 @@ public String getId() { public static ChatPlugin loadJSON(String json, APIContext context, String header) { ChatPlugin chatPlugin = getGson().fromJson(json, ChatPlugin.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(chatPlugin.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(chatPlugin.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -98,10 +97,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList chatPlugins = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CheckBatchRequestStatus.java b/src/main/java/com/facebook/ads/sdk/CheckBatchRequestStatus.java index a98b440e..9e9ae4a4 100644 --- a/src/main/java/com/facebook/ads/sdk/CheckBatchRequestStatus.java +++ b/src/main/java/com/facebook/ads/sdk/CheckBatchRequestStatus.java @@ -66,9 +66,8 @@ public String getId() { public static CheckBatchRequestStatus loadJSON(String json, APIContext context, String header) { CheckBatchRequestStatus checkBatchRequestStatus = getGson().fromJson(json, CheckBatchRequestStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(checkBatchRequestStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(checkBatchRequestStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, AP APINodeList checkBatchRequestStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ChildEvent.java b/src/main/java/com/facebook/ads/sdk/ChildEvent.java index 72dfef3f..f5ad38cf 100644 --- a/src/main/java/com/facebook/ads/sdk/ChildEvent.java +++ b/src/main/java/com/facebook/ads/sdk/ChildEvent.java @@ -60,9 +60,8 @@ public String getId() { public static ChildEvent loadJSON(String json, APIContext context, String header) { ChildEvent childEvent = getGson().fromJson(json, ChildEvent.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(childEvent.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(childEvent.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList childEvents = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ChinaBusinessOnboardingVettingRequest.java b/src/main/java/com/facebook/ads/sdk/ChinaBusinessOnboardingVettingRequest.java index df924887..0c7a2391 100644 --- a/src/main/java/com/facebook/ads/sdk/ChinaBusinessOnboardingVettingRequest.java +++ b/src/main/java/com/facebook/ads/sdk/ChinaBusinessOnboardingVettingRequest.java @@ -195,9 +195,8 @@ public String getId() { public static ChinaBusinessOnboardingVettingRequest loadJSON(String json, APIContext context, String header) { ChinaBusinessOnboardingVettingRequest chinaBusinessOnboardingVettingRequest = getGson().fromJson(json, ChinaBusinessOnboardingVettingRequest.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(chinaBusinessOnboardingVettingRequest.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(chinaBusinessOnboardingVettingRequest.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -217,10 +216,10 @@ public static APINodeList parseResponse(S APINodeList chinaBusinessOnboardingVettingRequests = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; + new JsonParser(); try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CloudGame.java b/src/main/java/com/facebook/ads/sdk/CloudGame.java index fb459d2c..646b8086 100644 --- a/src/main/java/com/facebook/ads/sdk/CloudGame.java +++ b/src/main/java/com/facebook/ads/sdk/CloudGame.java @@ -129,9 +129,8 @@ public String getId() { public static CloudGame loadJSON(String json, APIContext context, String header) { CloudGame cloudGame = getGson().fromJson(json, CloudGame.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(cloudGame.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(cloudGame.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse(String json, APIContext conte APINodeList cloudGames = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CloudbridgeDatasetStatus.java b/src/main/java/com/facebook/ads/sdk/CloudbridgeDatasetStatus.java index 2d278cc1..b096f493 100644 --- a/src/main/java/com/facebook/ads/sdk/CloudbridgeDatasetStatus.java +++ b/src/main/java/com/facebook/ads/sdk/CloudbridgeDatasetStatus.java @@ -64,9 +64,8 @@ public String getId() { public static CloudbridgeDatasetStatus loadJSON(String json, APIContext context, String header) { CloudbridgeDatasetStatus cloudbridgeDatasetStatus = getGson().fromJson(json, CloudbridgeDatasetStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(cloudbridgeDatasetStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(cloudbridgeDatasetStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, A APINodeList cloudbridgeDatasetStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CollaborativeAdsPartnerBusinesses.java b/src/main/java/com/facebook/ads/sdk/CollaborativeAdsPartnerBusinesses.java index 5791b951..224d447d 100644 --- a/src/main/java/com/facebook/ads/sdk/CollaborativeAdsPartnerBusinesses.java +++ b/src/main/java/com/facebook/ads/sdk/CollaborativeAdsPartnerBusinesses.java @@ -56,9 +56,8 @@ public String getId() { public static CollaborativeAdsPartnerBusinesses loadJSON(String json, APIContext context, String header) { CollaborativeAdsPartnerBusinesses collaborativeAdsPartnerBusinesses = getGson().fromJson(json, CollaborativeAdsPartnerBusinesses.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(collaborativeAdsPartnerBusinesses.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(collaborativeAdsPartnerBusinesses.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(Strin APINodeList collaborativeAdsPartnerBusinessess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CollaborativeAdsPartnerInfoListItem.java b/src/main/java/com/facebook/ads/sdk/CollaborativeAdsPartnerInfoListItem.java index af39009e..194a6873 100644 --- a/src/main/java/com/facebook/ads/sdk/CollaborativeAdsPartnerInfoListItem.java +++ b/src/main/java/com/facebook/ads/sdk/CollaborativeAdsPartnerInfoListItem.java @@ -52,9 +52,8 @@ public String getId() { public static CollaborativeAdsPartnerInfoListItem loadJSON(String json, APIContext context, String header) { CollaborativeAdsPartnerInfoListItem collaborativeAdsPartnerInfoListItem = getGson().fromJson(json, CollaborativeAdsPartnerInfoListItem.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(collaborativeAdsPartnerInfoListItem.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(collaborativeAdsPartnerInfoListItem.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseResponse(Str APINodeList collaborativeAdsPartnerInfoListItems = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CollaborativeAdsShareSettings.java b/src/main/java/com/facebook/ads/sdk/CollaborativeAdsShareSettings.java index 2b05b5df..52e8de5c 100644 --- a/src/main/java/com/facebook/ads/sdk/CollaborativeAdsShareSettings.java +++ b/src/main/java/com/facebook/ads/sdk/CollaborativeAdsShareSettings.java @@ -123,9 +123,8 @@ public String getId() { public static CollaborativeAdsShareSettings loadJSON(String json, APIContext context, String header) { CollaborativeAdsShareSettings collaborativeAdsShareSettings = getGson().fromJson(json, CollaborativeAdsShareSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(collaborativeAdsShareSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(collaborativeAdsShareSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String js APINodeList collaborativeAdsShareSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ColumnSuggestions.java b/src/main/java/com/facebook/ads/sdk/ColumnSuggestions.java index 86f0706e..23ec9f7d 100644 --- a/src/main/java/com/facebook/ads/sdk/ColumnSuggestions.java +++ b/src/main/java/com/facebook/ads/sdk/ColumnSuggestions.java @@ -60,9 +60,8 @@ public String getId() { public static ColumnSuggestions loadJSON(String json, APIContext context, String header) { ColumnSuggestions columnSuggestions = getGson().fromJson(json, ColumnSuggestions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(columnSuggestions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(columnSuggestions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList columnSuggestionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Comment.java b/src/main/java/com/facebook/ads/sdk/Comment.java index ed28c9dd..f951d980 100644 --- a/src/main/java/com/facebook/ads/sdk/Comment.java +++ b/src/main/java/com/facebook/ads/sdk/Comment.java @@ -157,9 +157,8 @@ public String getId() { public static Comment loadJSON(String json, APIContext context, String header) { Comment comment = getGson().fromJson(json, Comment.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(comment.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(comment.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -179,10 +178,9 @@ public static APINodeList parseResponse(String json, APIContext context APINodeList comments = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CommerceMerchantSettings.java b/src/main/java/com/facebook/ads/sdk/CommerceMerchantSettings.java index f011d25d..ec3b722b 100644 --- a/src/main/java/com/facebook/ads/sdk/CommerceMerchantSettings.java +++ b/src/main/java/com/facebook/ads/sdk/CommerceMerchantSettings.java @@ -139,9 +139,8 @@ public String getId() { public static CommerceMerchantSettings loadJSON(String json, APIContext context, String header) { CommerceMerchantSettings commerceMerchantSettings = getGson().fromJson(json, CommerceMerchantSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(commerceMerchantSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(commerceMerchantSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -161,10 +160,9 @@ public static APINodeList parseResponse(String json, A APINodeList commerceMerchantSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CommerceMerchantSettingsSetupStatus.java b/src/main/java/com/facebook/ads/sdk/CommerceMerchantSettingsSetupStatus.java index 191f04e9..298feb4d 100644 --- a/src/main/java/com/facebook/ads/sdk/CommerceMerchantSettingsSetupStatus.java +++ b/src/main/java/com/facebook/ads/sdk/CommerceMerchantSettingsSetupStatus.java @@ -64,9 +64,8 @@ public String getId() { public static CommerceMerchantSettingsSetupStatus loadJSON(String json, APIContext context, String header) { CommerceMerchantSettingsSetupStatus commerceMerchantSettingsSetupStatus = getGson().fromJson(json, CommerceMerchantSettingsSetupStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(commerceMerchantSettingsSetupStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(commerceMerchantSettingsSetupStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(Str APINodeList commerceMerchantSettingsSetupStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CommerceOrder.java b/src/main/java/com/facebook/ads/sdk/CommerceOrder.java index 7d342718..1463fc94 100644 --- a/src/main/java/com/facebook/ads/sdk/CommerceOrder.java +++ b/src/main/java/com/facebook/ads/sdk/CommerceOrder.java @@ -141,9 +141,8 @@ public String getId() { public static CommerceOrder loadJSON(String json, APIContext context, String header) { CommerceOrder commerceOrder = getGson().fromJson(json, CommerceOrder.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(commerceOrder.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(commerceOrder.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -163,10 +162,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList commerceOrders = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CommerceOrderTransactionDetail.java b/src/main/java/com/facebook/ads/sdk/CommerceOrderTransactionDetail.java index 198322a4..c19d2fe7 100644 --- a/src/main/java/com/facebook/ads/sdk/CommerceOrderTransactionDetail.java +++ b/src/main/java/com/facebook/ads/sdk/CommerceOrderTransactionDetail.java @@ -80,9 +80,8 @@ public String getId() { public static CommerceOrderTransactionDetail loadJSON(String json, APIContext context, String header) { CommerceOrderTransactionDetail commerceOrderTransactionDetail = getGson().fromJson(json, CommerceOrderTransactionDetail.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(commerceOrderTransactionDetail.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(commerceOrderTransactionDetail.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -102,10 +101,9 @@ public static APINodeList parseResponse(String j APINodeList commerceOrderTransactionDetails = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CommercePayout.java b/src/main/java/com/facebook/ads/sdk/CommercePayout.java index 916ad9b8..bff1a202 100644 --- a/src/main/java/com/facebook/ads/sdk/CommercePayout.java +++ b/src/main/java/com/facebook/ads/sdk/CommercePayout.java @@ -62,9 +62,8 @@ public String getId() { public static CommercePayout loadJSON(String json, APIContext context, String header) { CommercePayout commercePayout = getGson().fromJson(json, CommercePayout.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(commercePayout.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(commercePayout.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList commercePayouts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CommerceSettings.java b/src/main/java/com/facebook/ads/sdk/CommerceSettings.java index defa43bc..3e9c4c14 100644 --- a/src/main/java/com/facebook/ads/sdk/CommerceSettings.java +++ b/src/main/java/com/facebook/ads/sdk/CommerceSettings.java @@ -56,9 +56,8 @@ public String getId() { public static CommerceSettings loadJSON(String json, APIContext context, String header) { CommerceSettings commerceSettings = getGson().fromJson(json, CommerceSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(commerceSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(commerceSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList commerceSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ConnectionsTargeting.java b/src/main/java/com/facebook/ads/sdk/ConnectionsTargeting.java index 8fc98dde..b5bde704 100644 --- a/src/main/java/com/facebook/ads/sdk/ConnectionsTargeting.java +++ b/src/main/java/com/facebook/ads/sdk/ConnectionsTargeting.java @@ -56,9 +56,8 @@ public String getId() { public static ConnectionsTargeting loadJSON(String json, APIContext context, String header) { ConnectionsTargeting connectionsTargeting = getGson().fromJson(json, ConnectionsTargeting.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(connectionsTargeting.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(connectionsTargeting.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList connectionsTargetings = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ContactsMessengerSyncConfig.java b/src/main/java/com/facebook/ads/sdk/ContactsMessengerSyncConfig.java index c6ad1de8..f865daba 100644 --- a/src/main/java/com/facebook/ads/sdk/ContactsMessengerSyncConfig.java +++ b/src/main/java/com/facebook/ads/sdk/ContactsMessengerSyncConfig.java @@ -54,9 +54,8 @@ public String getId() { public static ContactsMessengerSyncConfig loadJSON(String json, APIContext context, String header) { ContactsMessengerSyncConfig contactsMessengerSyncConfig = getGson().fromJson(json, ContactsMessengerSyncConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(contactsMessengerSyncConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(contactsMessengerSyncConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json APINodeList contactsMessengerSyncConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ContentBlockList.java b/src/main/java/com/facebook/ads/sdk/ContentBlockList.java index 9e9eb5cd..80333449 100644 --- a/src/main/java/com/facebook/ads/sdk/ContentBlockList.java +++ b/src/main/java/com/facebook/ads/sdk/ContentBlockList.java @@ -117,9 +117,8 @@ public String getId() { public static ContentBlockList loadJSON(String json, APIContext context, String header) { ContentBlockList contentBlockList = getGson().fromJson(json, ContentBlockList.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(contentBlockList.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(contentBlockList.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList contentBlockLists = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ContentDeliveryReport.java b/src/main/java/com/facebook/ads/sdk/ContentDeliveryReport.java index eed8abc5..a0a48eeb 100644 --- a/src/main/java/com/facebook/ads/sdk/ContentDeliveryReport.java +++ b/src/main/java/com/facebook/ads/sdk/ContentDeliveryReport.java @@ -62,9 +62,8 @@ public String getId() { public static ContentDeliveryReport loadJSON(String json, APIContext context, String header) { ContentDeliveryReport contentDeliveryReport = getGson().fromJson(json, ContentDeliveryReport.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(contentDeliveryReport.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(contentDeliveryReport.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList contentDeliveryReports = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ContentPublishingLimitResponse.java b/src/main/java/com/facebook/ads/sdk/ContentPublishingLimitResponse.java index 51a0f451..c1021129 100644 --- a/src/main/java/com/facebook/ads/sdk/ContentPublishingLimitResponse.java +++ b/src/main/java/com/facebook/ads/sdk/ContentPublishingLimitResponse.java @@ -56,9 +56,8 @@ public String getId() { public static ContentPublishingLimitResponse loadJSON(String json, APIContext context, String header) { ContentPublishingLimitResponse contentPublishingLimitResponse = getGson().fromJson(json, ContentPublishingLimitResponse.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(contentPublishingLimitResponse.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(contentPublishingLimitResponse.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String j APINodeList contentPublishingLimitResponses = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ContextualBundlingSpec.java b/src/main/java/com/facebook/ads/sdk/ContextualBundlingSpec.java index f372acac..cd807821 100644 --- a/src/main/java/com/facebook/ads/sdk/ContextualBundlingSpec.java +++ b/src/main/java/com/facebook/ads/sdk/ContextualBundlingSpec.java @@ -54,9 +54,8 @@ public String getId() { public static ContextualBundlingSpec loadJSON(String json, APIContext context, String header) { ContextualBundlingSpec contextualBundlingSpec = getGson().fromJson(json, ContextualBundlingSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(contextualBundlingSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(contextualBundlingSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, API APINodeList contextualBundlingSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ConversionActionQuery.java b/src/main/java/com/facebook/ads/sdk/ConversionActionQuery.java index 38b6b0f9..8d83fed8 100644 --- a/src/main/java/com/facebook/ads/sdk/ConversionActionQuery.java +++ b/src/main/java/com/facebook/ads/sdk/ConversionActionQuery.java @@ -104,9 +104,8 @@ public String getId() { public static ConversionActionQuery loadJSON(String json, APIContext context, String header) { ConversionActionQuery conversionActionQuery = getGson().fromJson(json, ConversionActionQuery.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(conversionActionQuery.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(conversionActionQuery.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -126,10 +125,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList conversionActionQuerys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ConversionHealthKPI.java b/src/main/java/com/facebook/ads/sdk/ConversionHealthKPI.java index 2b3a2ee8..ee896791 100644 --- a/src/main/java/com/facebook/ads/sdk/ConversionHealthKPI.java +++ b/src/main/java/com/facebook/ads/sdk/ConversionHealthKPI.java @@ -70,9 +70,8 @@ public String getId() { public static ConversionHealthKPI loadJSON(String json, APIContext context, String header) { ConversionHealthKPI conversionHealthKPI = getGson().fromJson(json, ConversionHealthKPI.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(conversionHealthKPI.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(conversionHealthKPI.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList conversionHealthKPIs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CopyrightAttributionInsights.java b/src/main/java/com/facebook/ads/sdk/CopyrightAttributionInsights.java index 5043d357..7f93bd23 100644 --- a/src/main/java/com/facebook/ads/sdk/CopyrightAttributionInsights.java +++ b/src/main/java/com/facebook/ads/sdk/CopyrightAttributionInsights.java @@ -62,9 +62,8 @@ public String getId() { public static CopyrightAttributionInsights loadJSON(String json, APIContext context, String header) { CopyrightAttributionInsights copyrightAttributionInsights = getGson().fromJson(json, CopyrightAttributionInsights.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(copyrightAttributionInsights.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(copyrightAttributionInsights.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String jso APINodeList copyrightAttributionInsightss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CopyrightAudioAsset.java b/src/main/java/com/facebook/ads/sdk/CopyrightAudioAsset.java index 5099ba27..cd189c78 100644 --- a/src/main/java/com/facebook/ads/sdk/CopyrightAudioAsset.java +++ b/src/main/java/com/facebook/ads/sdk/CopyrightAudioAsset.java @@ -66,9 +66,8 @@ public String getId() { public static CopyrightAudioAsset loadJSON(String json, APIContext context, String header) { CopyrightAudioAsset copyrightAudioAsset = getGson().fromJson(json, CopyrightAudioAsset.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(copyrightAudioAsset.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(copyrightAudioAsset.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList copyrightAudioAssets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CopyrightMediaMisuse.java b/src/main/java/com/facebook/ads/sdk/CopyrightMediaMisuse.java index 1616a32d..bf9de6a1 100644 --- a/src/main/java/com/facebook/ads/sdk/CopyrightMediaMisuse.java +++ b/src/main/java/com/facebook/ads/sdk/CopyrightMediaMisuse.java @@ -145,9 +145,8 @@ public String getId() { public static CopyrightMediaMisuse loadJSON(String json, APIContext context, String header) { CopyrightMediaMisuse copyrightMediaMisuse = getGson().fromJson(json, CopyrightMediaMisuse.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(copyrightMediaMisuse.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(copyrightMediaMisuse.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -167,10 +166,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList copyrightMediaMisuses = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CopyrightReferenceContainer.java b/src/main/java/com/facebook/ads/sdk/CopyrightReferenceContainer.java index ffc69fe1..bf124214 100644 --- a/src/main/java/com/facebook/ads/sdk/CopyrightReferenceContainer.java +++ b/src/main/java/com/facebook/ads/sdk/CopyrightReferenceContainer.java @@ -76,9 +76,8 @@ public String getId() { public static CopyrightReferenceContainer loadJSON(String json, APIContext context, String header) { CopyrightReferenceContainer copyrightReferenceContainer = getGson().fromJson(json, CopyrightReferenceContainer.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(copyrightReferenceContainer.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(copyrightReferenceContainer.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -98,10 +97,9 @@ public static APINodeList parseResponse(String json APINodeList copyrightReferenceContainers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CoverPhoto.java b/src/main/java/com/facebook/ads/sdk/CoverPhoto.java index 669de7c6..d6818a72 100644 --- a/src/main/java/com/facebook/ads/sdk/CoverPhoto.java +++ b/src/main/java/com/facebook/ads/sdk/CoverPhoto.java @@ -62,9 +62,8 @@ public String getId() { public static CoverPhoto loadJSON(String json, APIContext context, String header) { CoverPhoto coverPhoto = getGson().fromJson(json, CoverPhoto.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(coverPhoto.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(coverPhoto.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList coverPhotos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CreativeAssetTag.java b/src/main/java/com/facebook/ads/sdk/CreativeAssetTag.java index c4142d45..2344991a 100644 --- a/src/main/java/com/facebook/ads/sdk/CreativeAssetTag.java +++ b/src/main/java/com/facebook/ads/sdk/CreativeAssetTag.java @@ -54,9 +54,8 @@ public String getId() { public static CreativeAssetTag loadJSON(String json, APIContext context, String header) { CreativeAssetTag creativeAssetTag = getGson().fromJson(json, CreativeAssetTag.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(creativeAssetTag.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(creativeAssetTag.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList creativeAssetTags = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CreativeHistory.java b/src/main/java/com/facebook/ads/sdk/CreativeHistory.java index bb6b3881..65b9103d 100644 --- a/src/main/java/com/facebook/ads/sdk/CreativeHistory.java +++ b/src/main/java/com/facebook/ads/sdk/CreativeHistory.java @@ -56,9 +56,8 @@ public String getId() { public static CreativeHistory loadJSON(String json, APIContext context, String header) { CreativeHistory creativeHistory = getGson().fromJson(json, CreativeHistory.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(creativeHistory.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(creativeHistory.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList creativeHistorys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CreatorAssetCreative.java b/src/main/java/com/facebook/ads/sdk/CreatorAssetCreative.java index 56a25c82..56249002 100644 --- a/src/main/java/com/facebook/ads/sdk/CreatorAssetCreative.java +++ b/src/main/java/com/facebook/ads/sdk/CreatorAssetCreative.java @@ -125,9 +125,8 @@ public String getId() { public static CreatorAssetCreative loadJSON(String json, APIContext context, String header) { CreatorAssetCreative creatorAssetCreative = getGson().fromJson(json, CreatorAssetCreative.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(creatorAssetCreative.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(creatorAssetCreative.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList creatorAssetCreatives = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CreditCard.java b/src/main/java/com/facebook/ads/sdk/CreditCard.java index 2f9969d2..10fb48cc 100644 --- a/src/main/java/com/facebook/ads/sdk/CreditCard.java +++ b/src/main/java/com/facebook/ads/sdk/CreditCard.java @@ -153,9 +153,8 @@ public String getId() { public static CreditCard loadJSON(String json, APIContext context, String header) { CreditCard creditCard = getGson().fromJson(json, CreditCard.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(creditCard.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(creditCard.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -175,10 +174,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList creditCards = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CreditPartitionActionOptions.java b/src/main/java/com/facebook/ads/sdk/CreditPartitionActionOptions.java index 36d44200..75e4ca14 100644 --- a/src/main/java/com/facebook/ads/sdk/CreditPartitionActionOptions.java +++ b/src/main/java/com/facebook/ads/sdk/CreditPartitionActionOptions.java @@ -58,9 +58,8 @@ public String getId() { public static CreditPartitionActionOptions loadJSON(String json, APIContext context, String header) { CreditPartitionActionOptions creditPartitionActionOptions = getGson().fromJson(json, CreditPartitionActionOptions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(creditPartitionActionOptions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(creditPartitionActionOptions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String jso APINodeList creditPartitionActionOptionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Currency.java b/src/main/java/com/facebook/ads/sdk/Currency.java index db4969fc..a3847cee 100644 --- a/src/main/java/com/facebook/ads/sdk/Currency.java +++ b/src/main/java/com/facebook/ads/sdk/Currency.java @@ -60,9 +60,8 @@ public String getId() { public static Currency loadJSON(String json, APIContext context, String header) { Currency currency = getGson().fromJson(json, Currency.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(currency.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(currency.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList currencys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CurrencyAmount.java b/src/main/java/com/facebook/ads/sdk/CurrencyAmount.java index 532a1b75..c0d2244b 100644 --- a/src/main/java/com/facebook/ads/sdk/CurrencyAmount.java +++ b/src/main/java/com/facebook/ads/sdk/CurrencyAmount.java @@ -60,9 +60,8 @@ public String getId() { public static CurrencyAmount loadJSON(String json, APIContext context, String header) { CurrencyAmount currencyAmount = getGson().fromJson(json, CurrencyAmount.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(currencyAmount.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(currencyAmount.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList currencyAmounts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CustomAudience.java b/src/main/java/com/facebook/ads/sdk/CustomAudience.java index eb594789..2eed1b97 100644 --- a/src/main/java/com/facebook/ads/sdk/CustomAudience.java +++ b/src/main/java/com/facebook/ads/sdk/CustomAudience.java @@ -189,9 +189,8 @@ public String getId() { public static CustomAudience loadJSON(String json, APIContext context, String header) { CustomAudience customAudience = getGson().fromJson(json, CustomAudience.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(customAudience.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(customAudience.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -211,10 +210,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList customAudiences = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CustomAudienceAdAccount.java b/src/main/java/com/facebook/ads/sdk/CustomAudienceAdAccount.java index 9bc35483..71f7e174 100644 --- a/src/main/java/com/facebook/ads/sdk/CustomAudienceAdAccount.java +++ b/src/main/java/com/facebook/ads/sdk/CustomAudienceAdAccount.java @@ -54,9 +54,8 @@ public String getId() { public static CustomAudienceAdAccount loadJSON(String json, APIContext context, String header) { CustomAudienceAdAccount customAudienceAdAccount = getGson().fromJson(json, CustomAudienceAdAccount.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(customAudienceAdAccount.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(customAudienceAdAccount.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, AP APINodeList customAudienceAdAccounts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CustomAudienceCapabilities.java b/src/main/java/com/facebook/ads/sdk/CustomAudienceCapabilities.java index 843038b5..1ed96725 100644 --- a/src/main/java/com/facebook/ads/sdk/CustomAudienceCapabilities.java +++ b/src/main/java/com/facebook/ads/sdk/CustomAudienceCapabilities.java @@ -54,9 +54,8 @@ public String getId() { public static CustomAudienceCapabilities loadJSON(String json, APIContext context, String header) { CustomAudienceCapabilities customAudienceCapabilities = getGson().fromJson(json, CustomAudienceCapabilities.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(customAudienceCapabilities.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(customAudienceCapabilities.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APINodeList customAudienceCapabilitiess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CustomAudienceDataSource.java b/src/main/java/com/facebook/ads/sdk/CustomAudienceDataSource.java index 14c03638..a06a36fe 100644 --- a/src/main/java/com/facebook/ads/sdk/CustomAudienceDataSource.java +++ b/src/main/java/com/facebook/ads/sdk/CustomAudienceDataSource.java @@ -58,9 +58,8 @@ public String getId() { public static CustomAudienceDataSource loadJSON(String json, APIContext context, String header) { CustomAudienceDataSource customAudienceDataSource = getGson().fromJson(json, CustomAudienceDataSource.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(customAudienceDataSource.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(customAudienceDataSource.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, A APINodeList customAudienceDataSources = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CustomAudienceGroup.java b/src/main/java/com/facebook/ads/sdk/CustomAudienceGroup.java index 74abe9fe..044f1ea9 100644 --- a/src/main/java/com/facebook/ads/sdk/CustomAudienceGroup.java +++ b/src/main/java/com/facebook/ads/sdk/CustomAudienceGroup.java @@ -58,9 +58,8 @@ public String getId() { public static CustomAudienceGroup loadJSON(String json, APIContext context, String header) { CustomAudienceGroup customAudienceGroup = getGson().fromJson(json, CustomAudienceGroup.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(customAudienceGroup.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(customAudienceGroup.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList customAudienceGroups = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CustomAudienceSalts.java b/src/main/java/com/facebook/ads/sdk/CustomAudienceSalts.java index c8311233..6d2f1899 100644 --- a/src/main/java/com/facebook/ads/sdk/CustomAudienceSalts.java +++ b/src/main/java/com/facebook/ads/sdk/CustomAudienceSalts.java @@ -56,9 +56,8 @@ public String getId() { public static CustomAudienceSalts loadJSON(String json, APIContext context, String header) { CustomAudienceSalts customAudienceSalts = getGson().fromJson(json, CustomAudienceSalts.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(customAudienceSalts.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(customAudienceSalts.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList customAudienceSaltss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CustomAudienceSession.java b/src/main/java/com/facebook/ads/sdk/CustomAudienceSession.java index ad21247c..b1e3ae4f 100644 --- a/src/main/java/com/facebook/ads/sdk/CustomAudienceSession.java +++ b/src/main/java/com/facebook/ads/sdk/CustomAudienceSession.java @@ -68,9 +68,8 @@ public String getId() { public static CustomAudienceSession loadJSON(String json, APIContext context, String header) { CustomAudienceSession customAudienceSession = getGson().fromJson(json, CustomAudienceSession.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(customAudienceSession.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(customAudienceSession.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList customAudienceSessions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CustomAudienceSharedAccountCampaignInfo.java b/src/main/java/com/facebook/ads/sdk/CustomAudienceSharedAccountCampaignInfo.java index 42790aa3..f9ff650f 100644 --- a/src/main/java/com/facebook/ads/sdk/CustomAudienceSharedAccountCampaignInfo.java +++ b/src/main/java/com/facebook/ads/sdk/CustomAudienceSharedAccountCampaignInfo.java @@ -68,9 +68,8 @@ public String getId() { public static CustomAudienceSharedAccountCampaignInfo loadJSON(String json, APIContext context, String header) { CustomAudienceSharedAccountCampaignInfo customAudienceSharedAccountCampaignInfo = getGson().fromJson(json, CustomAudienceSharedAccountCampaignInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(customAudienceSharedAccountCampaignInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(customAudienceSharedAccountCampaignInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse APINodeList customAudienceSharedAccountCampaignInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CustomAudienceSharingStatus.java b/src/main/java/com/facebook/ads/sdk/CustomAudienceSharingStatus.java index 5c216c00..bcbe0f88 100644 --- a/src/main/java/com/facebook/ads/sdk/CustomAudienceSharingStatus.java +++ b/src/main/java/com/facebook/ads/sdk/CustomAudienceSharingStatus.java @@ -56,9 +56,8 @@ public String getId() { public static CustomAudienceSharingStatus loadJSON(String json, APIContext context, String header) { CustomAudienceSharingStatus customAudienceSharingStatus = getGson().fromJson(json, CustomAudienceSharingStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(customAudienceSharingStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(customAudienceSharingStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json APINodeList customAudienceSharingStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CustomAudienceStatus.java b/src/main/java/com/facebook/ads/sdk/CustomAudienceStatus.java index 66d7bf11..3efc0a29 100644 --- a/src/main/java/com/facebook/ads/sdk/CustomAudienceStatus.java +++ b/src/main/java/com/facebook/ads/sdk/CustomAudienceStatus.java @@ -56,9 +56,8 @@ public String getId() { public static CustomAudienceStatus loadJSON(String json, APIContext context, String header) { CustomAudienceStatus customAudienceStatus = getGson().fromJson(json, CustomAudienceStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(customAudienceStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(customAudienceStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList customAudienceStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CustomAudiencesTOS.java b/src/main/java/com/facebook/ads/sdk/CustomAudiencesTOS.java index 315d1487..41a993df 100644 --- a/src/main/java/com/facebook/ads/sdk/CustomAudiencesTOS.java +++ b/src/main/java/com/facebook/ads/sdk/CustomAudiencesTOS.java @@ -58,9 +58,8 @@ public String getId() { public static CustomAudiencesTOS loadJSON(String json, APIContext context, String header) { CustomAudiencesTOS customAudiencesTOS = getGson().fromJson(json, CustomAudiencesTOS.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(customAudiencesTOS.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(customAudiencesTOS.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList customAudiencesTOSs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CustomAudiencesharedAccountInfo.java b/src/main/java/com/facebook/ads/sdk/CustomAudiencesharedAccountInfo.java index c81cdf24..e5ad9db9 100644 --- a/src/main/java/com/facebook/ads/sdk/CustomAudiencesharedAccountInfo.java +++ b/src/main/java/com/facebook/ads/sdk/CustomAudiencesharedAccountInfo.java @@ -62,9 +62,8 @@ public String getId() { public static CustomAudiencesharedAccountInfo loadJSON(String json, APIContext context, String header) { CustomAudiencesharedAccountInfo customAudiencesharedAccountInfo = getGson().fromJson(json, CustomAudiencesharedAccountInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(customAudiencesharedAccountInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(customAudiencesharedAccountInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String APINodeList customAudiencesharedAccountInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CustomConversion.java b/src/main/java/com/facebook/ads/sdk/CustomConversion.java index 2f0c6ec3..b0990fdf 100644 --- a/src/main/java/com/facebook/ads/sdk/CustomConversion.java +++ b/src/main/java/com/facebook/ads/sdk/CustomConversion.java @@ -149,9 +149,8 @@ public String getId() { public static CustomConversion loadJSON(String json, APIContext context, String header) { CustomConversion customConversion = getGson().fromJson(json, CustomConversion.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(customConversion.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(customConversion.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -171,10 +170,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList customConversions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CustomConversionActivities.java b/src/main/java/com/facebook/ads/sdk/CustomConversionActivities.java index 3228d5cf..262530b1 100644 --- a/src/main/java/com/facebook/ads/sdk/CustomConversionActivities.java +++ b/src/main/java/com/facebook/ads/sdk/CustomConversionActivities.java @@ -60,9 +60,8 @@ public String getId() { public static CustomConversionActivities loadJSON(String json, APIContext context, String header) { CustomConversionActivities customConversionActivities = getGson().fromJson(json, CustomConversionActivities.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(customConversionActivities.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(customConversionActivities.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APINodeList customConversionActivitiess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CustomConversionStatsResult.java b/src/main/java/com/facebook/ads/sdk/CustomConversionStatsResult.java index e6c05ee7..c0e46771 100644 --- a/src/main/java/com/facebook/ads/sdk/CustomConversionStatsResult.java +++ b/src/main/java/com/facebook/ads/sdk/CustomConversionStatsResult.java @@ -58,9 +58,8 @@ public String getId() { public static CustomConversionStatsResult loadJSON(String json, APIContext context, String header) { CustomConversionStatsResult customConversionStatsResult = getGson().fromJson(json, CustomConversionStatsResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(customConversionStatsResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(customConversionStatsResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json APINodeList customConversionStatsResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/CustomUserSettings.java b/src/main/java/com/facebook/ads/sdk/CustomUserSettings.java index 5d2026a0..21e572a6 100644 --- a/src/main/java/com/facebook/ads/sdk/CustomUserSettings.java +++ b/src/main/java/com/facebook/ads/sdk/CustomUserSettings.java @@ -56,9 +56,8 @@ public String getId() { public static CustomUserSettings loadJSON(String json, APIContext context, String header) { CustomUserSettings customUserSettings = getGson().fromJson(json, CustomUserSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(customUserSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(customUserSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList customUserSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/DACheck.java b/src/main/java/com/facebook/ads/sdk/DACheck.java index 35d70f39..ca2bbb4a 100644 --- a/src/main/java/com/facebook/ads/sdk/DACheck.java +++ b/src/main/java/com/facebook/ads/sdk/DACheck.java @@ -64,9 +64,8 @@ public String getId() { public static DACheck loadJSON(String json, APIContext context, String header) { DACheck daCheck = getGson().fromJson(json, DACheck.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(daCheck.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(daCheck.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APIContext context APINodeList daChecks = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Dataset.java b/src/main/java/com/facebook/ads/sdk/Dataset.java index 8e9b5f41..338b9f1b 100644 --- a/src/main/java/com/facebook/ads/sdk/Dataset.java +++ b/src/main/java/com/facebook/ads/sdk/Dataset.java @@ -56,9 +56,8 @@ public String getId() { public static Dataset loadJSON(String json, APIContext context, String header) { Dataset dataset = getGson().fromJson(json, Dataset.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(dataset.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(dataset.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext context APINodeList datasets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/DayPart.java b/src/main/java/com/facebook/ads/sdk/DayPart.java index 221f148b..4d1cdd54 100644 --- a/src/main/java/com/facebook/ads/sdk/DayPart.java +++ b/src/main/java/com/facebook/ads/sdk/DayPart.java @@ -60,9 +60,8 @@ public String getId() { public static DayPart loadJSON(String json, APIContext context, String header) { DayPart dayPart = getGson().fromJson(json, DayPart.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(dayPart.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(dayPart.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContext context APINodeList dayParts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/DeliveryCheck.java b/src/main/java/com/facebook/ads/sdk/DeliveryCheck.java index 1eb1c65e..a375ee19 100644 --- a/src/main/java/com/facebook/ads/sdk/DeliveryCheck.java +++ b/src/main/java/com/facebook/ads/sdk/DeliveryCheck.java @@ -60,9 +60,8 @@ public String getId() { public static DeliveryCheck loadJSON(String json, APIContext context, String header) { DeliveryCheck deliveryCheck = getGson().fromJson(json, DeliveryCheck.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(deliveryCheck.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(deliveryCheck.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList deliveryChecks = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/DeliveryCheckExtraInfo.java b/src/main/java/com/facebook/ads/sdk/DeliveryCheckExtraInfo.java index 7516d6c7..a94a8209 100644 --- a/src/main/java/com/facebook/ads/sdk/DeliveryCheckExtraInfo.java +++ b/src/main/java/com/facebook/ads/sdk/DeliveryCheckExtraInfo.java @@ -58,9 +58,8 @@ public String getId() { public static DeliveryCheckExtraInfo loadJSON(String json, APIContext context, String header) { DeliveryCheckExtraInfo deliveryCheckExtraInfo = getGson().fromJson(json, DeliveryCheckExtraInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(deliveryCheckExtraInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(deliveryCheckExtraInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, API APINodeList deliveryCheckExtraInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/DeliveryInfo.java b/src/main/java/com/facebook/ads/sdk/DeliveryInfo.java index 2c529283..1058da2d 100644 --- a/src/main/java/com/facebook/ads/sdk/DeliveryInfo.java +++ b/src/main/java/com/facebook/ads/sdk/DeliveryInfo.java @@ -136,9 +136,8 @@ public String getId() { public static DeliveryInfo loadJSON(String json, APIContext context, String header) { DeliveryInfo deliveryInfo = getGson().fromJson(json, DeliveryInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(deliveryInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(deliveryInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -158,10 +157,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList deliveryInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/DeliveryStatus.java b/src/main/java/com/facebook/ads/sdk/DeliveryStatus.java index 40352773..25e706d8 100644 --- a/src/main/java/com/facebook/ads/sdk/DeliveryStatus.java +++ b/src/main/java/com/facebook/ads/sdk/DeliveryStatus.java @@ -56,9 +56,8 @@ public String getId() { public static DeliveryStatus loadJSON(String json, APIContext context, String header) { DeliveryStatus deliveryStatus = getGson().fromJson(json, DeliveryStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(deliveryStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(deliveryStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList deliveryStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/DeliveryWindow.java b/src/main/java/com/facebook/ads/sdk/DeliveryWindow.java index 33a9ec73..c871cb70 100644 --- a/src/main/java/com/facebook/ads/sdk/DeliveryWindow.java +++ b/src/main/java/com/facebook/ads/sdk/DeliveryWindow.java @@ -556,9 +556,8 @@ public String getId() { public static DeliveryWindow loadJSON(String json, APIContext context, String header) { DeliveryWindow deliveryWindow = getGson().fromJson(json, DeliveryWindow.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(deliveryWindow.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(deliveryWindow.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -578,10 +577,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList deliveryWindows = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Destination.java b/src/main/java/com/facebook/ads/sdk/Destination.java index 89d9e6cb..340f9198 100644 --- a/src/main/java/com/facebook/ads/sdk/Destination.java +++ b/src/main/java/com/facebook/ads/sdk/Destination.java @@ -147,9 +147,8 @@ public String getId() { public static Destination loadJSON(String json, APIContext context, String header) { Destination destination = getGson().fromJson(json, Destination.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(destination.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(destination.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -169,10 +168,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList destinations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/DirectDebit.java b/src/main/java/com/facebook/ads/sdk/DirectDebit.java index e538c901..72a4eb45 100644 --- a/src/main/java/com/facebook/ads/sdk/DirectDebit.java +++ b/src/main/java/com/facebook/ads/sdk/DirectDebit.java @@ -72,9 +72,8 @@ public String getId() { public static DirectDebit loadJSON(String json, APIContext context, String header) { DirectDebit directDebit = getGson().fromJson(json, DirectDebit.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(directDebit.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(directDebit.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -94,10 +93,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList directDebits = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Domain.java b/src/main/java/com/facebook/ads/sdk/Domain.java index 2f63d830..cf770717 100644 --- a/src/main/java/com/facebook/ads/sdk/Domain.java +++ b/src/main/java/com/facebook/ads/sdk/Domain.java @@ -117,9 +117,8 @@ public String getId() { public static Domain loadJSON(String json, APIContext context, String header) { Domain domain = getGson().fromJson(json, Domain.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(domain.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(domain.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APIContext context, APINodeList domains = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/DraftPost.java b/src/main/java/com/facebook/ads/sdk/DraftPost.java index 6f645a29..d4f6e6be 100644 --- a/src/main/java/com/facebook/ads/sdk/DraftPost.java +++ b/src/main/java/com/facebook/ads/sdk/DraftPost.java @@ -86,9 +86,8 @@ public String getId() { public static DraftPost loadJSON(String json, APIContext context, String header) { DraftPost draftPost = getGson().fromJson(json, DraftPost.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(draftPost.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(draftPost.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -108,10 +107,9 @@ public static APINodeList parseResponse(String json, APIContext conte APINodeList draftPosts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/DynamicARMetadata.java b/src/main/java/com/facebook/ads/sdk/DynamicARMetadata.java index d6120857..9d2a905e 100644 --- a/src/main/java/com/facebook/ads/sdk/DynamicARMetadata.java +++ b/src/main/java/com/facebook/ads/sdk/DynamicARMetadata.java @@ -135,9 +135,8 @@ public String getId() { public static DynamicARMetadata loadJSON(String json, APIContext context, String header) { DynamicARMetadata dynamicARMetadata = getGson().fromJson(json, DynamicARMetadata.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(dynamicARMetadata.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(dynamicARMetadata.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -157,10 +156,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList dynamicARMetadatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/DynamicContentSet.java b/src/main/java/com/facebook/ads/sdk/DynamicContentSet.java index e6bf463d..0eb213db 100644 --- a/src/main/java/com/facebook/ads/sdk/DynamicContentSet.java +++ b/src/main/java/com/facebook/ads/sdk/DynamicContentSet.java @@ -117,9 +117,8 @@ public String getId() { public static DynamicContentSet loadJSON(String json, APIContext context, String header) { DynamicContentSet dynamicContentSet = getGson().fromJson(json, DynamicContentSet.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(dynamicContentSet.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(dynamicContentSet.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList dynamicContentSets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/DynamicItemDisplayBundle.java b/src/main/java/com/facebook/ads/sdk/DynamicItemDisplayBundle.java index 8dd60709..f49f9922 100644 --- a/src/main/java/com/facebook/ads/sdk/DynamicItemDisplayBundle.java +++ b/src/main/java/com/facebook/ads/sdk/DynamicItemDisplayBundle.java @@ -125,9 +125,8 @@ public String getId() { public static DynamicItemDisplayBundle loadJSON(String json, APIContext context, String header) { DynamicItemDisplayBundle dynamicItemDisplayBundle = getGson().fromJson(json, DynamicItemDisplayBundle.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(dynamicItemDisplayBundle.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(dynamicItemDisplayBundle.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, A APINodeList dynamicItemDisplayBundles = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/DynamicItemDisplayBundleFolder.java b/src/main/java/com/facebook/ads/sdk/DynamicItemDisplayBundleFolder.java index b6840423..a04988bf 100644 --- a/src/main/java/com/facebook/ads/sdk/DynamicItemDisplayBundleFolder.java +++ b/src/main/java/com/facebook/ads/sdk/DynamicItemDisplayBundleFolder.java @@ -123,9 +123,8 @@ public String getId() { public static DynamicItemDisplayBundleFolder loadJSON(String json, APIContext context, String header) { DynamicItemDisplayBundleFolder dynamicItemDisplayBundleFolder = getGson().fromJson(json, DynamicItemDisplayBundleFolder.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(dynamicItemDisplayBundleFolder.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(dynamicItemDisplayBundleFolder.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String j APINodeList dynamicItemDisplayBundleFolders = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/DynamicPostChildAttachment.java b/src/main/java/com/facebook/ads/sdk/DynamicPostChildAttachment.java index 1e5645aa..7092daa4 100644 --- a/src/main/java/com/facebook/ads/sdk/DynamicPostChildAttachment.java +++ b/src/main/java/com/facebook/ads/sdk/DynamicPostChildAttachment.java @@ -64,9 +64,8 @@ public String getId() { public static DynamicPostChildAttachment loadJSON(String json, APIContext context, String header) { DynamicPostChildAttachment dynamicPostChildAttachment = getGson().fromJson(json, DynamicPostChildAttachment.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(dynamicPostChildAttachment.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(dynamicPostChildAttachment.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APINodeList dynamicPostChildAttachments = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/DynamicPriceConfigByDate.java b/src/main/java/com/facebook/ads/sdk/DynamicPriceConfigByDate.java index f1e02d05..ae499a5e 100644 --- a/src/main/java/com/facebook/ads/sdk/DynamicPriceConfigByDate.java +++ b/src/main/java/com/facebook/ads/sdk/DynamicPriceConfigByDate.java @@ -119,9 +119,8 @@ public String getId() { public static DynamicPriceConfigByDate loadJSON(String json, APIContext context, String header) { DynamicPriceConfigByDate dynamicPriceConfigByDate = getGson().fromJson(json, DynamicPriceConfigByDate.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(dynamicPriceConfigByDate.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(dynamicPriceConfigByDate.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, A APINodeList dynamicPriceConfigByDates = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/DynamicVideoMetadata.java b/src/main/java/com/facebook/ads/sdk/DynamicVideoMetadata.java index ab911907..e682be83 100644 --- a/src/main/java/com/facebook/ads/sdk/DynamicVideoMetadata.java +++ b/src/main/java/com/facebook/ads/sdk/DynamicVideoMetadata.java @@ -119,9 +119,8 @@ public String getId() { public static DynamicVideoMetadata loadJSON(String json, APIContext context, String header) { DynamicVideoMetadata dynamicVideoMetadata = getGson().fromJson(json, DynamicVideoMetadata.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(dynamicVideoMetadata.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(dynamicVideoMetadata.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList dynamicVideoMetadatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/EducationExperience.java b/src/main/java/com/facebook/ads/sdk/EducationExperience.java index 6e7a2327..ab1b45f6 100644 --- a/src/main/java/com/facebook/ads/sdk/EducationExperience.java +++ b/src/main/java/com/facebook/ads/sdk/EducationExperience.java @@ -127,9 +127,8 @@ public String getId() { public static EducationExperience loadJSON(String json, APIContext context, String header) { EducationExperience educationExperience = getGson().fromJson(json, EducationExperience.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(educationExperience.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(educationExperience.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -149,10 +148,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList educationExperiences = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/EmailImport.java b/src/main/java/com/facebook/ads/sdk/EmailImport.java index bab5c9bc..3e1a0450 100644 --- a/src/main/java/com/facebook/ads/sdk/EmailImport.java +++ b/src/main/java/com/facebook/ads/sdk/EmailImport.java @@ -56,9 +56,8 @@ public String getId() { public static EmailImport loadJSON(String json, APIContext context, String header) { EmailImport emailImport = getGson().fromJson(json, EmailImport.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(emailImport.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(emailImport.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList emailImports = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/EndStudyCriteria.java b/src/main/java/com/facebook/ads/sdk/EndStudyCriteria.java index dc9abb20..16899396 100644 --- a/src/main/java/com/facebook/ads/sdk/EndStudyCriteria.java +++ b/src/main/java/com/facebook/ads/sdk/EndStudyCriteria.java @@ -52,9 +52,8 @@ public String getId() { public static EndStudyCriteria loadJSON(String json, APIContext context, String header) { EndStudyCriteria endStudyCriteria = getGson().fromJson(json, EndStudyCriteria.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(endStudyCriteria.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(endStudyCriteria.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList endStudyCriterias = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Engagement.java b/src/main/java/com/facebook/ads/sdk/Engagement.java index 2378431f..2d17973a 100644 --- a/src/main/java/com/facebook/ads/sdk/Engagement.java +++ b/src/main/java/com/facebook/ads/sdk/Engagement.java @@ -66,9 +66,8 @@ public String getId() { public static Engagement loadJSON(String json, APIContext context, String header) { Engagement engagement = getGson().fromJson(json, Engagement.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(engagement.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(engagement.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList engagements = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/EntWithSponsor.java b/src/main/java/com/facebook/ads/sdk/EntWithSponsor.java index fca6203e..84420dfb 100644 --- a/src/main/java/com/facebook/ads/sdk/EntWithSponsor.java +++ b/src/main/java/com/facebook/ads/sdk/EntWithSponsor.java @@ -62,9 +62,8 @@ public String getId() { public static EntWithSponsor loadJSON(String json, APIContext context, String header) { EntWithSponsor entWithSponsor = getGson().fromJson(json, EntWithSponsor.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(entWithSponsor.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(entWithSponsor.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList entWithSponsors = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/EntityAtTextRange.java b/src/main/java/com/facebook/ads/sdk/EntityAtTextRange.java index de3836b0..9737fc58 100644 --- a/src/main/java/com/facebook/ads/sdk/EntityAtTextRange.java +++ b/src/main/java/com/facebook/ads/sdk/EntityAtTextRange.java @@ -64,9 +64,8 @@ public String getId() { public static EntityAtTextRange loadJSON(String json, APIContext context, String header) { EntityAtTextRange entityAtTextRange = getGson().fromJson(json, EntityAtTextRange.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(entityAtTextRange.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(entityAtTextRange.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList entityAtTextRanges = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Event.java b/src/main/java/com/facebook/ads/sdk/Event.java index a2db563c..8bc5ed67 100644 --- a/src/main/java/com/facebook/ads/sdk/Event.java +++ b/src/main/java/com/facebook/ads/sdk/Event.java @@ -183,9 +183,8 @@ public String getId() { public static Event loadJSON(String json, APIContext context, String header) { Event event = getGson().fromJson(json, Event.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(event.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(event.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -205,10 +204,9 @@ public static APINodeList parseResponse(String json, APIContext context, APINodeList events = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/EventExternalTicketInfo.java b/src/main/java/com/facebook/ads/sdk/EventExternalTicketInfo.java index a0015250..600cc211 100644 --- a/src/main/java/com/facebook/ads/sdk/EventExternalTicketInfo.java +++ b/src/main/java/com/facebook/ads/sdk/EventExternalTicketInfo.java @@ -119,9 +119,8 @@ public String getId() { public static EventExternalTicketInfo loadJSON(String json, APIContext context, String header) { EventExternalTicketInfo eventExternalTicketInfo = getGson().fromJson(json, EventExternalTicketInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(eventExternalTicketInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(eventExternalTicketInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, AP APINodeList eventExternalTicketInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/EventRegistrationSetting.java b/src/main/java/com/facebook/ads/sdk/EventRegistrationSetting.java index ffdaf588..50f2f5e0 100644 --- a/src/main/java/com/facebook/ads/sdk/EventRegistrationSetting.java +++ b/src/main/java/com/facebook/ads/sdk/EventRegistrationSetting.java @@ -119,9 +119,8 @@ public String getId() { public static EventRegistrationSetting loadJSON(String json, APIContext context, String header) { EventRegistrationSetting eventRegistrationSetting = getGson().fromJson(json, EventRegistrationSetting.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(eventRegistrationSetting.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(eventRegistrationSetting.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, A APINodeList eventRegistrationSettings = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/EventSourceGroup.java b/src/main/java/com/facebook/ads/sdk/EventSourceGroup.java index 23c5158b..02540b2d 100644 --- a/src/main/java/com/facebook/ads/sdk/EventSourceGroup.java +++ b/src/main/java/com/facebook/ads/sdk/EventSourceGroup.java @@ -121,9 +121,8 @@ public String getId() { public static EventSourceGroup loadJSON(String json, APIContext context, String header) { EventSourceGroup eventSourceGroup = getGson().fromJson(json, EventSourceGroup.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(eventSourceGroup.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(eventSourceGroup.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList eventSourceGroups = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/EventTicketSetting.java b/src/main/java/com/facebook/ads/sdk/EventTicketSetting.java index b34c59e9..9d6417a8 100644 --- a/src/main/java/com/facebook/ads/sdk/EventTicketSetting.java +++ b/src/main/java/com/facebook/ads/sdk/EventTicketSetting.java @@ -115,9 +115,8 @@ public String getId() { public static EventTicketSetting loadJSON(String json, APIContext context, String header) { EventTicketSetting eventTicketSetting = getGson().fromJson(json, EventTicketSetting.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(eventTicketSetting.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(eventTicketSetting.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList eventTicketSettings = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/EventTicketTier.java b/src/main/java/com/facebook/ads/sdk/EventTicketTier.java index 32605795..6e395903 100644 --- a/src/main/java/com/facebook/ads/sdk/EventTicketTier.java +++ b/src/main/java/com/facebook/ads/sdk/EventTicketTier.java @@ -147,9 +147,8 @@ public String getId() { public static EventTicketTier loadJSON(String json, APIContext context, String header) { EventTicketTier eventTicketTier = getGson().fromJson(json, EventTicketTier.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(eventTicketTier.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(eventTicketTier.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -169,10 +168,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList eventTicketTiers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/EventTour.java b/src/main/java/com/facebook/ads/sdk/EventTour.java index ba05bba3..9aa28797 100644 --- a/src/main/java/com/facebook/ads/sdk/EventTour.java +++ b/src/main/java/com/facebook/ads/sdk/EventTour.java @@ -137,9 +137,8 @@ public String getId() { public static EventTour loadJSON(String json, APIContext context, String header) { EventTour eventTour = getGson().fromJson(json, EventTour.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(eventTour.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(eventTour.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -159,10 +158,9 @@ public static APINodeList parseResponse(String json, APIContext conte APINodeList eventTours = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Experience.java b/src/main/java/com/facebook/ads/sdk/Experience.java index b27f46ab..11b8b629 100644 --- a/src/main/java/com/facebook/ads/sdk/Experience.java +++ b/src/main/java/com/facebook/ads/sdk/Experience.java @@ -62,9 +62,8 @@ public String getId() { public static Experience loadJSON(String json, APIContext context, String header) { Experience experience = getGson().fromJson(json, Experience.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(experience.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(experience.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList experiences = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ExtendedCredit.java b/src/main/java/com/facebook/ads/sdk/ExtendedCredit.java index 7e532de7..79028e71 100644 --- a/src/main/java/com/facebook/ads/sdk/ExtendedCredit.java +++ b/src/main/java/com/facebook/ads/sdk/ExtendedCredit.java @@ -149,9 +149,8 @@ public String getId() { public static ExtendedCredit loadJSON(String json, APIContext context, String header) { ExtendedCredit extendedCredit = getGson().fromJson(json, ExtendedCredit.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(extendedCredit.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(extendedCredit.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -171,10 +170,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList extendedCredits = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ExtendedCreditAllocationConfig.java b/src/main/java/com/facebook/ads/sdk/ExtendedCreditAllocationConfig.java index 39a67dce..ee8cad35 100644 --- a/src/main/java/com/facebook/ads/sdk/ExtendedCreditAllocationConfig.java +++ b/src/main/java/com/facebook/ads/sdk/ExtendedCreditAllocationConfig.java @@ -131,9 +131,8 @@ public String getId() { public static ExtendedCreditAllocationConfig loadJSON(String json, APIContext context, String header) { ExtendedCreditAllocationConfig extendedCreditAllocationConfig = getGson().fromJson(json, ExtendedCreditAllocationConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(extendedCreditAllocationConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(extendedCreditAllocationConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -153,10 +152,9 @@ public static APINodeList parseResponse(String j APINodeList extendedCreditAllocationConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ExtendedCreditApplication.java b/src/main/java/com/facebook/ads/sdk/ExtendedCreditApplication.java index 782b05ec..9ec69cfe 100644 --- a/src/main/java/com/facebook/ads/sdk/ExtendedCreditApplication.java +++ b/src/main/java/com/facebook/ads/sdk/ExtendedCreditApplication.java @@ -161,9 +161,8 @@ public String getId() { public static ExtendedCreditApplication loadJSON(String json, APIContext context, String header) { ExtendedCreditApplication extendedCreditApplication = getGson().fromJson(json, ExtendedCreditApplication.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(extendedCreditApplication.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(extendedCreditApplication.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -183,10 +182,9 @@ public static APINodeList parseResponse(String json, APINodeList extendedCreditApplications = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ExtendedCreditEmail.java b/src/main/java/com/facebook/ads/sdk/ExtendedCreditEmail.java index 96f9be8f..c55c7189 100644 --- a/src/main/java/com/facebook/ads/sdk/ExtendedCreditEmail.java +++ b/src/main/java/com/facebook/ads/sdk/ExtendedCreditEmail.java @@ -56,9 +56,8 @@ public String getId() { public static ExtendedCreditEmail loadJSON(String json, APIContext context, String header) { ExtendedCreditEmail extendedCreditEmail = getGson().fromJson(json, ExtendedCreditEmail.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(extendedCreditEmail.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(extendedCreditEmail.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList extendedCreditEmails = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ExtendedCreditInfo.java b/src/main/java/com/facebook/ads/sdk/ExtendedCreditInfo.java index c24c9cff..6ab1f2a5 100644 --- a/src/main/java/com/facebook/ads/sdk/ExtendedCreditInfo.java +++ b/src/main/java/com/facebook/ads/sdk/ExtendedCreditInfo.java @@ -60,9 +60,8 @@ public String getId() { public static ExtendedCreditInfo loadJSON(String json, APIContext context, String header) { ExtendedCreditInfo extendedCreditInfo = getGson().fromJson(json, ExtendedCreditInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(extendedCreditInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(extendedCreditInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList extendedCreditInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ExtendedCreditInvoiceGroup.java b/src/main/java/com/facebook/ads/sdk/ExtendedCreditInvoiceGroup.java index 803f5a65..3bad68ac 100644 --- a/src/main/java/com/facebook/ads/sdk/ExtendedCreditInvoiceGroup.java +++ b/src/main/java/com/facebook/ads/sdk/ExtendedCreditInvoiceGroup.java @@ -129,9 +129,8 @@ public String getId() { public static ExtendedCreditInvoiceGroup loadJSON(String json, APIContext context, String header) { ExtendedCreditInvoiceGroup extendedCreditInvoiceGroup = getGson().fromJson(json, ExtendedCreditInvoiceGroup.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(extendedCreditInvoiceGroup.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(extendedCreditInvoiceGroup.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse(String json, APINodeList extendedCreditInvoiceGroups = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ExternalEventSource.java b/src/main/java/com/facebook/ads/sdk/ExternalEventSource.java index fffba903..cc33309c 100644 --- a/src/main/java/com/facebook/ads/sdk/ExternalEventSource.java +++ b/src/main/java/com/facebook/ads/sdk/ExternalEventSource.java @@ -58,9 +58,8 @@ public String getId() { public static ExternalEventSource loadJSON(String json, APIContext context, String header) { ExternalEventSource externalEventSource = getGson().fromJson(json, ExternalEventSource.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(externalEventSource.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(externalEventSource.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList externalEventSources = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ExternalEventSourceCPASEventsDebugging.java b/src/main/java/com/facebook/ads/sdk/ExternalEventSourceCPASEventsDebugging.java index 229007f7..ec3c01d4 100644 --- a/src/main/java/com/facebook/ads/sdk/ExternalEventSourceCPASEventsDebugging.java +++ b/src/main/java/com/facebook/ads/sdk/ExternalEventSourceCPASEventsDebugging.java @@ -70,9 +70,8 @@ public String getId() { public static ExternalEventSourceCPASEventsDebugging loadJSON(String json, APIContext context, String header) { ExternalEventSourceCPASEventsDebugging externalEventSourceCPASEventsDebugging = getGson().fromJson(json, ExternalEventSourceCPASEventsDebugging.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(externalEventSourceCPASEventsDebugging.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(externalEventSourceCPASEventsDebugging.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse( APINodeList externalEventSourceCPASEventsDebuggings = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ExternalEventSourceCPASEventsDebuggingInfo.java b/src/main/java/com/facebook/ads/sdk/ExternalEventSourceCPASEventsDebuggingInfo.java index 3291cbd7..6c64db87 100644 --- a/src/main/java/com/facebook/ads/sdk/ExternalEventSourceCPASEventsDebuggingInfo.java +++ b/src/main/java/com/facebook/ads/sdk/ExternalEventSourceCPASEventsDebuggingInfo.java @@ -58,9 +58,8 @@ public String getId() { public static ExternalEventSourceCPASEventsDebuggingInfo loadJSON(String json, APIContext context, String header) { ExternalEventSourceCPASEventsDebuggingInfo externalEventSourceCPASEventsDebuggingInfo = getGson().fromJson(json, ExternalEventSourceCPASEventsDebuggingInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(externalEventSourceCPASEventsDebuggingInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(externalEventSourceCPASEventsDebuggingInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseRespo APINodeList externalEventSourceCPASEventsDebuggingInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ExternalMerchantSettings.java b/src/main/java/com/facebook/ads/sdk/ExternalMerchantSettings.java index 9af247d9..7570b97a 100644 --- a/src/main/java/com/facebook/ads/sdk/ExternalMerchantSettings.java +++ b/src/main/java/com/facebook/ads/sdk/ExternalMerchantSettings.java @@ -117,9 +117,8 @@ public String getId() { public static ExternalMerchantSettings loadJSON(String json, APIContext context, String header) { ExternalMerchantSettings externalMerchantSettings = getGson().fromJson(json, ExternalMerchantSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(externalMerchantSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(externalMerchantSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, A APINodeList externalMerchantSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/FAMEKumo.java b/src/main/java/com/facebook/ads/sdk/FAMEKumo.java index 372e5c82..3c5b2c36 100644 --- a/src/main/java/com/facebook/ads/sdk/FAMEKumo.java +++ b/src/main/java/com/facebook/ads/sdk/FAMEKumo.java @@ -113,9 +113,8 @@ public String getId() { public static FAMEKumo loadJSON(String json, APIContext context, String header) { FAMEKumo fameKumo = getGson().fromJson(json, FAMEKumo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(fameKumo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(fameKumo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -135,10 +134,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList fameKumos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/FBImageCopyrightMatch.java b/src/main/java/com/facebook/ads/sdk/FBImageCopyrightMatch.java index 9766a044..4a649c1d 100644 --- a/src/main/java/com/facebook/ads/sdk/FBImageCopyrightMatch.java +++ b/src/main/java/com/facebook/ads/sdk/FBImageCopyrightMatch.java @@ -137,9 +137,8 @@ public String getId() { public static FBImageCopyrightMatch loadJSON(String json, APIContext context, String header) { FBImageCopyrightMatch fbImageCopyrightMatch = getGson().fromJson(json, FBImageCopyrightMatch.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(fbImageCopyrightMatch.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(fbImageCopyrightMatch.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -159,10 +158,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList fbImageCopyrightMatchs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/FBLiteToNTTransitions.java b/src/main/java/com/facebook/ads/sdk/FBLiteToNTTransitions.java index 3c852520..85093264 100644 --- a/src/main/java/com/facebook/ads/sdk/FBLiteToNTTransitions.java +++ b/src/main/java/com/facebook/ads/sdk/FBLiteToNTTransitions.java @@ -54,9 +54,8 @@ public String getId() { public static FBLiteToNTTransitions loadJSON(String json, APIContext context, String header) { FBLiteToNTTransitions fbLiteToNTTransitions = getGson().fromJson(json, FBLiteToNTTransitions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(fbLiteToNTTransitions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(fbLiteToNTTransitions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList fbLiteToNTTransitionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/FBPageAndInstagramAccount.java b/src/main/java/com/facebook/ads/sdk/FBPageAndInstagramAccount.java index 3fd8610b..398f7ea4 100644 --- a/src/main/java/com/facebook/ads/sdk/FBPageAndInstagramAccount.java +++ b/src/main/java/com/facebook/ads/sdk/FBPageAndInstagramAccount.java @@ -62,9 +62,8 @@ public String getId() { public static FBPageAndInstagramAccount loadJSON(String json, APIContext context, String header) { FBPageAndInstagramAccount fbPageAndInstagramAccount = getGson().fromJson(json, FBPageAndInstagramAccount.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(fbPageAndInstagramAccount.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(fbPageAndInstagramAccount.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APINodeList fbPageAndInstagramAccounts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/FBPayButtonLogin.java b/src/main/java/com/facebook/ads/sdk/FBPayButtonLogin.java index 7cdb0b63..87e29304 100644 --- a/src/main/java/com/facebook/ads/sdk/FBPayButtonLogin.java +++ b/src/main/java/com/facebook/ads/sdk/FBPayButtonLogin.java @@ -52,9 +52,8 @@ public String getId() { public static FBPayButtonLogin loadJSON(String json, APIContext context, String header) { FBPayButtonLogin fbPayButtonLogin = getGson().fromJson(json, FBPayButtonLogin.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(fbPayButtonLogin.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(fbPayButtonLogin.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList fbPayButtonLogins = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/FantasyGame.java b/src/main/java/com/facebook/ads/sdk/FantasyGame.java index ed37ef5f..56b3e995 100644 --- a/src/main/java/com/facebook/ads/sdk/FantasyGame.java +++ b/src/main/java/com/facebook/ads/sdk/FantasyGame.java @@ -115,9 +115,8 @@ public String getId() { public static FantasyGame loadJSON(String json, APIContext context, String header) { FantasyGame fantasyGame = getGson().fromJson(json, FantasyGame.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(fantasyGame.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(fantasyGame.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList fantasyGames = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/FavoriteCatalog.java b/src/main/java/com/facebook/ads/sdk/FavoriteCatalog.java index 97fe3231..d0f8e40e 100644 --- a/src/main/java/com/facebook/ads/sdk/FavoriteCatalog.java +++ b/src/main/java/com/facebook/ads/sdk/FavoriteCatalog.java @@ -115,9 +115,8 @@ public String getId() { public static FavoriteCatalog loadJSON(String json, APIContext context, String header) { FavoriteCatalog favoriteCatalog = getGson().fromJson(json, FavoriteCatalog.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(favoriteCatalog.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(favoriteCatalog.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList favoriteCatalogs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/FinanceObject.java b/src/main/java/com/facebook/ads/sdk/FinanceObject.java index 5567bdac..1cfb3771 100644 --- a/src/main/java/com/facebook/ads/sdk/FinanceObject.java +++ b/src/main/java/com/facebook/ads/sdk/FinanceObject.java @@ -56,9 +56,8 @@ public String getId() { public static FinanceObject loadJSON(String json, APIContext context, String header) { FinanceObject financeObject = getGson().fromJson(json, FinanceObject.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(financeObject.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(financeObject.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList financeObjects = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/FlexibleTargeting.java b/src/main/java/com/facebook/ads/sdk/FlexibleTargeting.java index 8feaab7e..57340d1d 100644 --- a/src/main/java/com/facebook/ads/sdk/FlexibleTargeting.java +++ b/src/main/java/com/facebook/ads/sdk/FlexibleTargeting.java @@ -108,9 +108,8 @@ public String getId() { public static FlexibleTargeting loadJSON(String json, APIContext context, String header) { FlexibleTargeting flexibleTargeting = getGson().fromJson(json, FlexibleTargeting.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(flexibleTargeting.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(flexibleTargeting.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -130,10 +129,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList flexibleTargetings = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Flight.java b/src/main/java/com/facebook/ads/sdk/Flight.java index fd27ba78..8c82d8bb 100644 --- a/src/main/java/com/facebook/ads/sdk/Flight.java +++ b/src/main/java/com/facebook/ads/sdk/Flight.java @@ -151,9 +151,8 @@ public String getId() { public static Flight loadJSON(String json, APIContext context, String header) { Flight flight = getGson().fromJson(json, Flight.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(flight.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(flight.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -173,10 +172,9 @@ public static APINodeList parseResponse(String json, APIContext context, APINodeList flights = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/FranchiseProgram.java b/src/main/java/com/facebook/ads/sdk/FranchiseProgram.java index 2f64319b..9d910272 100644 --- a/src/main/java/com/facebook/ads/sdk/FranchiseProgram.java +++ b/src/main/java/com/facebook/ads/sdk/FranchiseProgram.java @@ -135,9 +135,8 @@ public String getId() { public static FranchiseProgram loadJSON(String json, APIContext context, String header) { FranchiseProgram franchiseProgram = getGson().fromJson(json, FranchiseProgram.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(franchiseProgram.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(franchiseProgram.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -157,10 +156,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList franchisePrograms = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/FranchiseProgramMember.java b/src/main/java/com/facebook/ads/sdk/FranchiseProgramMember.java index bad57e19..9d158888 100644 --- a/src/main/java/com/facebook/ads/sdk/FranchiseProgramMember.java +++ b/src/main/java/com/facebook/ads/sdk/FranchiseProgramMember.java @@ -127,9 +127,8 @@ public String getId() { public static FranchiseProgramMember loadJSON(String json, APIContext context, String header) { FranchiseProgramMember franchiseProgramMember = getGson().fromJson(json, FranchiseProgramMember.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(franchiseProgramMember.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(franchiseProgramMember.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -149,10 +148,9 @@ public static APINodeList parseResponse(String json, API APINodeList franchiseProgramMembers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/FundingSourceDetails.java b/src/main/java/com/facebook/ads/sdk/FundingSourceDetails.java index 5eb03587..fc3b4950 100644 --- a/src/main/java/com/facebook/ads/sdk/FundingSourceDetails.java +++ b/src/main/java/com/facebook/ads/sdk/FundingSourceDetails.java @@ -62,9 +62,8 @@ public String getId() { public static FundingSourceDetails loadJSON(String json, APIContext context, String header) { FundingSourceDetails fundingSourceDetails = getGson().fromJson(json, FundingSourceDetails.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(fundingSourceDetails.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(fundingSourceDetails.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList fundingSourceDetailss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/FundingSourceDetailsCoupon.java b/src/main/java/com/facebook/ads/sdk/FundingSourceDetailsCoupon.java index d052ecbd..3084173a 100644 --- a/src/main/java/com/facebook/ads/sdk/FundingSourceDetailsCoupon.java +++ b/src/main/java/com/facebook/ads/sdk/FundingSourceDetailsCoupon.java @@ -68,9 +68,8 @@ public String getId() { public static FundingSourceDetailsCoupon loadJSON(String json, APIContext context, String header) { FundingSourceDetailsCoupon fundingSourceDetailsCoupon = getGson().fromJson(json, FundingSourceDetailsCoupon.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(fundingSourceDetailsCoupon.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(fundingSourceDetailsCoupon.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String json, APINodeList fundingSourceDetailsCoupons = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/FundraiserPersonToCharity.java b/src/main/java/com/facebook/ads/sdk/FundraiserPersonToCharity.java index f04c12c4..a3a38d0e 100644 --- a/src/main/java/com/facebook/ads/sdk/FundraiserPersonToCharity.java +++ b/src/main/java/com/facebook/ads/sdk/FundraiserPersonToCharity.java @@ -155,9 +155,8 @@ public String getId() { public static FundraiserPersonToCharity loadJSON(String json, APIContext context, String header) { FundraiserPersonToCharity fundraiserPersonToCharity = getGson().fromJson(json, FundraiserPersonToCharity.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(fundraiserPersonToCharity.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(fundraiserPersonToCharity.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -177,10 +176,9 @@ public static APINodeList parseResponse(String json, APINodeList fundraiserPersonToCharitys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/GeoGatingPolicy.java b/src/main/java/com/facebook/ads/sdk/GeoGatingPolicy.java index 25366a5c..1c0df809 100644 --- a/src/main/java/com/facebook/ads/sdk/GeoGatingPolicy.java +++ b/src/main/java/com/facebook/ads/sdk/GeoGatingPolicy.java @@ -125,9 +125,8 @@ public String getId() { public static GeoGatingPolicy loadJSON(String json, APIContext context, String header) { GeoGatingPolicy geoGatingPolicy = getGson().fromJson(json, GeoGatingPolicy.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(geoGatingPolicy.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(geoGatingPolicy.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList geoGatingPolicys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Group.java b/src/main/java/com/facebook/ads/sdk/Group.java index bb65969a..22b25810 100644 --- a/src/main/java/com/facebook/ads/sdk/Group.java +++ b/src/main/java/com/facebook/ads/sdk/Group.java @@ -149,9 +149,8 @@ public String getId() { public static Group loadJSON(String json, APIContext context, String header) { Group group = getGson().fromJson(json, Group.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(group.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(group.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -171,10 +170,9 @@ public static APINodeList parseResponse(String json, APIContext context, APINodeList groups = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/HasLeadAccess.java b/src/main/java/com/facebook/ads/sdk/HasLeadAccess.java index ba0b2f2f..bbb1af6f 100644 --- a/src/main/java/com/facebook/ads/sdk/HasLeadAccess.java +++ b/src/main/java/com/facebook/ads/sdk/HasLeadAccess.java @@ -70,9 +70,8 @@ public String getId() { public static HasLeadAccess loadJSON(String json, APIContext context, String header) { HasLeadAccess hasLeadAccess = getGson().fromJson(json, HasLeadAccess.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(hasLeadAccess.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(hasLeadAccess.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList hasLeadAccesss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/HighDemandPeriod.java b/src/main/java/com/facebook/ads/sdk/HighDemandPeriod.java index b3ba226e..2575b241 100644 --- a/src/main/java/com/facebook/ads/sdk/HighDemandPeriod.java +++ b/src/main/java/com/facebook/ads/sdk/HighDemandPeriod.java @@ -127,9 +127,8 @@ public String getId() { public static HighDemandPeriod loadJSON(String json, APIContext context, String header) { HighDemandPeriod highDemandPeriod = getGson().fromJson(json, HighDemandPeriod.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(highDemandPeriod.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(highDemandPeriod.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -149,10 +148,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList highDemandPeriods = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/HighDemandPeriodTimeSuggestionWeeklySegment.java b/src/main/java/com/facebook/ads/sdk/HighDemandPeriodTimeSuggestionWeeklySegment.java index c8606ad2..f9654927 100644 --- a/src/main/java/com/facebook/ads/sdk/HighDemandPeriodTimeSuggestionWeeklySegment.java +++ b/src/main/java/com/facebook/ads/sdk/HighDemandPeriodTimeSuggestionWeeklySegment.java @@ -60,9 +60,8 @@ public String getId() { public static HighDemandPeriodTimeSuggestionWeeklySegment loadJSON(String json, APIContext context, String header) { HighDemandPeriodTimeSuggestionWeeklySegment highDemandPeriodTimeSuggestionWeeklySegment = getGson().fromJson(json, HighDemandPeriodTimeSuggestionWeeklySegment.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(highDemandPeriodTimeSuggestionWeeklySegment.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(highDemandPeriodTimeSuggestionWeeklySegment.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResp APINodeList highDemandPeriodTimeSuggestionWeeklySegments = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/HomeListing.java b/src/main/java/com/facebook/ads/sdk/HomeListing.java index 5ccc43db..e7d13909 100644 --- a/src/main/java/com/facebook/ads/sdk/HomeListing.java +++ b/src/main/java/com/facebook/ads/sdk/HomeListing.java @@ -203,9 +203,8 @@ public String getId() { public static HomeListing loadJSON(String json, APIContext context, String header) { HomeListing homeListing = getGson().fromJson(json, HomeListing.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(homeListing.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(homeListing.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -225,10 +224,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList homeListings = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Hotel.java b/src/main/java/com/facebook/ads/sdk/Hotel.java index 10b0f85d..54d6690c 100644 --- a/src/main/java/com/facebook/ads/sdk/Hotel.java +++ b/src/main/java/com/facebook/ads/sdk/Hotel.java @@ -169,9 +169,8 @@ public String getId() { public static Hotel loadJSON(String json, APIContext context, String header) { Hotel hotel = getGson().fromJson(json, Hotel.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(hotel.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(hotel.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -191,10 +190,9 @@ public static APINodeList parseResponse(String json, APIContext context, APINodeList hotels = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/HotelRoom.java b/src/main/java/com/facebook/ads/sdk/HotelRoom.java index 68e1118f..81431f02 100644 --- a/src/main/java/com/facebook/ads/sdk/HotelRoom.java +++ b/src/main/java/com/facebook/ads/sdk/HotelRoom.java @@ -133,9 +133,8 @@ public String getId() { public static HotelRoom loadJSON(String json, APIContext context, String header) { HotelRoom hotelRoom = getGson().fromJson(json, HotelRoom.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(hotelRoom.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(hotelRoom.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -155,10 +154,9 @@ public static APINodeList parseResponse(String json, APIContext conte APINodeList hotelRooms = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Hours.java b/src/main/java/com/facebook/ads/sdk/Hours.java index 2d72a914..22e2e307 100644 --- a/src/main/java/com/facebook/ads/sdk/Hours.java +++ b/src/main/java/com/facebook/ads/sdk/Hours.java @@ -115,9 +115,8 @@ public String getId() { public static Hours loadJSON(String json, APIContext context, String header) { Hours hours = getGson().fromJson(json, Hours.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(hours.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(hours.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, APIContext context, APINodeList hourss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IDName.java b/src/main/java/com/facebook/ads/sdk/IDName.java index c908d8ea..5b51771a 100644 --- a/src/main/java/com/facebook/ads/sdk/IDName.java +++ b/src/main/java/com/facebook/ads/sdk/IDName.java @@ -56,9 +56,8 @@ public String getId() { public static IDName loadJSON(String json, APIContext context, String header) { IDName idName = getGson().fromJson(json, IDName.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(idName.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(idName.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext context, APINodeList idNames = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGAccessTokenForIGOnlyAPI.java b/src/main/java/com/facebook/ads/sdk/IGAccessTokenForIGOnlyAPI.java index c811f86c..40990e6e 100644 --- a/src/main/java/com/facebook/ads/sdk/IGAccessTokenForIGOnlyAPI.java +++ b/src/main/java/com/facebook/ads/sdk/IGAccessTokenForIGOnlyAPI.java @@ -119,9 +119,8 @@ public String getId() { public static IGAccessTokenForIGOnlyAPI loadJSON(String json, APIContext context, String header) { IGAccessTokenForIGOnlyAPI igAccessTokenForIGOnlyAPI = getGson().fromJson(json, IGAccessTokenForIGOnlyAPI.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igAccessTokenForIGOnlyAPI.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igAccessTokenForIGOnlyAPI.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, APINodeList igAccessTokenForIGOnlyAPIs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGBCAdsPermission.java b/src/main/java/com/facebook/ads/sdk/IGBCAdsPermission.java index f05cd209..2e410aa4 100644 --- a/src/main/java/com/facebook/ads/sdk/IGBCAdsPermission.java +++ b/src/main/java/com/facebook/ads/sdk/IGBCAdsPermission.java @@ -117,9 +117,8 @@ public String getId() { public static IGBCAdsPermission loadJSON(String json, APIContext context, String header) { IGBCAdsPermission igbcAdsPermission = getGson().fromJson(json, IGBCAdsPermission.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igbcAdsPermission.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igbcAdsPermission.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList igbcAdsPermissions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGBoostMediaAd.java b/src/main/java/com/facebook/ads/sdk/IGBoostMediaAd.java index 1b5ebf77..c05e16f6 100644 --- a/src/main/java/com/facebook/ads/sdk/IGBoostMediaAd.java +++ b/src/main/java/com/facebook/ads/sdk/IGBoostMediaAd.java @@ -117,9 +117,8 @@ public String getId() { public static IGBoostMediaAd loadJSON(String json, APIContext context, String header) { IGBoostMediaAd igBoostMediaAd = getGson().fromJson(json, IGBoostMediaAd.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igBoostMediaAd.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igBoostMediaAd.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList igBoostMediaAds = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGComment.java b/src/main/java/com/facebook/ads/sdk/IGComment.java index f18a17ea..96ec3a86 100644 --- a/src/main/java/com/facebook/ads/sdk/IGComment.java +++ b/src/main/java/com/facebook/ads/sdk/IGComment.java @@ -131,9 +131,8 @@ public String getId() { public static IGComment loadJSON(String json, APIContext context, String header) { IGComment igComment = getGson().fromJson(json, IGComment.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igComment.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igComment.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -153,10 +152,9 @@ public static APINodeList parseResponse(String json, APIContext conte APINodeList igComments = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGCommentFromUser.java b/src/main/java/com/facebook/ads/sdk/IGCommentFromUser.java index 0396cf09..8ba30141 100644 --- a/src/main/java/com/facebook/ads/sdk/IGCommentFromUser.java +++ b/src/main/java/com/facebook/ads/sdk/IGCommentFromUser.java @@ -56,9 +56,8 @@ public String getId() { public static IGCommentFromUser loadJSON(String json, APIContext context, String header) { IGCommentFromUser igCommentFromUser = getGson().fromJson(json, IGCommentFromUser.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igCommentFromUser.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igCommentFromUser.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList igCommentFromUsers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGMedia.java b/src/main/java/com/facebook/ads/sdk/IGMedia.java index aa004ae0..a02eeca4 100644 --- a/src/main/java/com/facebook/ads/sdk/IGMedia.java +++ b/src/main/java/com/facebook/ads/sdk/IGMedia.java @@ -147,9 +147,8 @@ public String getId() { public static IGMedia loadJSON(String json, APIContext context, String header) { IGMedia igMedia = getGson().fromJson(json, IGMedia.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igMedia.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igMedia.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -169,10 +168,9 @@ public static APINodeList parseResponse(String json, APIContext context APINodeList igMedias = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGMediaBoostEligibilityInfo.java b/src/main/java/com/facebook/ads/sdk/IGMediaBoostEligibilityInfo.java index 45dfe301..82581957 100644 --- a/src/main/java/com/facebook/ads/sdk/IGMediaBoostEligibilityInfo.java +++ b/src/main/java/com/facebook/ads/sdk/IGMediaBoostEligibilityInfo.java @@ -117,9 +117,8 @@ public String getId() { public static IGMediaBoostEligibilityInfo loadJSON(String json, APIContext context, String header) { IGMediaBoostEligibilityInfo igMediaBoostEligibilityInfo = getGson().fromJson(json, IGMediaBoostEligibilityInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igMediaBoostEligibilityInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igMediaBoostEligibilityInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json APINodeList igMediaBoostEligibilityInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGMediaForIGOnlyAPI.java b/src/main/java/com/facebook/ads/sdk/IGMediaForIGOnlyAPI.java index c5c50212..a0fbeb58 100644 --- a/src/main/java/com/facebook/ads/sdk/IGMediaForIGOnlyAPI.java +++ b/src/main/java/com/facebook/ads/sdk/IGMediaForIGOnlyAPI.java @@ -141,9 +141,8 @@ public String getId() { public static IGMediaForIGOnlyAPI loadJSON(String json, APIContext context, String header) { IGMediaForIGOnlyAPI igMediaForIGOnlyAPI = getGson().fromJson(json, IGMediaForIGOnlyAPI.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igMediaForIGOnlyAPI.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igMediaForIGOnlyAPI.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -163,10 +162,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList igMediaForIGOnlyAPIs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGProductTaggingInvalidationError.java b/src/main/java/com/facebook/ads/sdk/IGProductTaggingInvalidationError.java index 0e3b9779..aa647549 100644 --- a/src/main/java/com/facebook/ads/sdk/IGProductTaggingInvalidationError.java +++ b/src/main/java/com/facebook/ads/sdk/IGProductTaggingInvalidationError.java @@ -58,9 +58,8 @@ public String getId() { public static IGProductTaggingInvalidationError loadJSON(String json, APIContext context, String header) { IGProductTaggingInvalidationError igProductTaggingInvalidationError = getGson().fromJson(json, IGProductTaggingInvalidationError.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igProductTaggingInvalidationError.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igProductTaggingInvalidationError.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(Strin APINodeList igProductTaggingInvalidationErrors = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGRefreshAccessTokenForIGOnlyAPI.java b/src/main/java/com/facebook/ads/sdk/IGRefreshAccessTokenForIGOnlyAPI.java index c300cd0c..2dec6887 100644 --- a/src/main/java/com/facebook/ads/sdk/IGRefreshAccessTokenForIGOnlyAPI.java +++ b/src/main/java/com/facebook/ads/sdk/IGRefreshAccessTokenForIGOnlyAPI.java @@ -121,9 +121,8 @@ public String getId() { public static IGRefreshAccessTokenForIGOnlyAPI loadJSON(String json, APIContext context, String header) { IGRefreshAccessTokenForIGOnlyAPI igRefreshAccessTokenForIGOnlyAPI = getGson().fromJson(json, IGRefreshAccessTokenForIGOnlyAPI.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igRefreshAccessTokenForIGOnlyAPI.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igRefreshAccessTokenForIGOnlyAPI.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String APINodeList igRefreshAccessTokenForIGOnlyAPIs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGResumableVideoUploadStatus.java b/src/main/java/com/facebook/ads/sdk/IGResumableVideoUploadStatus.java index 35c5992f..975fea00 100644 --- a/src/main/java/com/facebook/ads/sdk/IGResumableVideoUploadStatus.java +++ b/src/main/java/com/facebook/ads/sdk/IGResumableVideoUploadStatus.java @@ -56,9 +56,8 @@ public String getId() { public static IGResumableVideoUploadStatus loadJSON(String json, APIContext context, String header) { IGResumableVideoUploadStatus igResumableVideoUploadStatus = getGson().fromJson(json, IGResumableVideoUploadStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igResumableVideoUploadStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igResumableVideoUploadStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String jso APINodeList igResumableVideoUploadStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGShoppingProductAppeal.java b/src/main/java/com/facebook/ads/sdk/IGShoppingProductAppeal.java index 355ec9c1..e586758b 100644 --- a/src/main/java/com/facebook/ads/sdk/IGShoppingProductAppeal.java +++ b/src/main/java/com/facebook/ads/sdk/IGShoppingProductAppeal.java @@ -62,9 +62,8 @@ public String getId() { public static IGShoppingProductAppeal loadJSON(String json, APIContext context, String header) { IGShoppingProductAppeal igShoppingProductAppeal = getGson().fromJson(json, IGShoppingProductAppeal.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igShoppingProductAppeal.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igShoppingProductAppeal.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, AP APINodeList igShoppingProductAppeals = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGShoppingReviewStatus.java b/src/main/java/com/facebook/ads/sdk/IGShoppingReviewStatus.java index 7bff3f82..3cd66f1a 100644 --- a/src/main/java/com/facebook/ads/sdk/IGShoppingReviewStatus.java +++ b/src/main/java/com/facebook/ads/sdk/IGShoppingReviewStatus.java @@ -58,9 +58,8 @@ public String getId() { public static IGShoppingReviewStatus loadJSON(String json, APIContext context, String header) { IGShoppingReviewStatus igShoppingReviewStatus = getGson().fromJson(json, IGShoppingReviewStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igShoppingReviewStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igShoppingReviewStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, API APINodeList igShoppingReviewStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGShoppingReviewStatusOnsiteEligibility.java b/src/main/java/com/facebook/ads/sdk/IGShoppingReviewStatusOnsiteEligibility.java index c38babdd..60da6ab3 100644 --- a/src/main/java/com/facebook/ads/sdk/IGShoppingReviewStatusOnsiteEligibility.java +++ b/src/main/java/com/facebook/ads/sdk/IGShoppingReviewStatusOnsiteEligibility.java @@ -56,9 +56,8 @@ public String getId() { public static IGShoppingReviewStatusOnsiteEligibility loadJSON(String json, APIContext context, String header) { IGShoppingReviewStatusOnsiteEligibility igShoppingReviewStatusOnsiteEligibility = getGson().fromJson(json, IGShoppingReviewStatusOnsiteEligibility.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igShoppingReviewStatusOnsiteEligibility.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igShoppingReviewStatusOnsiteEligibility.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse APINodeList igShoppingReviewStatusOnsiteEligibilitys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGShoppingReviewStatusReasonWithHelpMessage.java b/src/main/java/com/facebook/ads/sdk/IGShoppingReviewStatusReasonWithHelpMessage.java index 7d2fa2f0..39616ffc 100644 --- a/src/main/java/com/facebook/ads/sdk/IGShoppingReviewStatusReasonWithHelpMessage.java +++ b/src/main/java/com/facebook/ads/sdk/IGShoppingReviewStatusReasonWithHelpMessage.java @@ -58,9 +58,8 @@ public String getId() { public static IGShoppingReviewStatusReasonWithHelpMessage loadJSON(String json, APIContext context, String header) { IGShoppingReviewStatusReasonWithHelpMessage igShoppingReviewStatusReasonWithHelpMessage = getGson().fromJson(json, IGShoppingReviewStatusReasonWithHelpMessage.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igShoppingReviewStatusReasonWithHelpMessage.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igShoppingReviewStatusReasonWithHelpMessage.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResp APINodeList igShoppingReviewStatusReasonWithHelpMessages = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGUpcomingEvent.java b/src/main/java/com/facebook/ads/sdk/IGUpcomingEvent.java index 2eff354a..aa98ef96 100644 --- a/src/main/java/com/facebook/ads/sdk/IGUpcomingEvent.java +++ b/src/main/java/com/facebook/ads/sdk/IGUpcomingEvent.java @@ -123,9 +123,8 @@ public String getId() { public static IGUpcomingEvent loadJSON(String json, APIContext context, String header) { IGUpcomingEvent igUpcomingEvent = getGson().fromJson(json, IGUpcomingEvent.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igUpcomingEvent.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igUpcomingEvent.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList igUpcomingEvents = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGUser.java b/src/main/java/com/facebook/ads/sdk/IGUser.java index ac03f371..bb45f499 100644 --- a/src/main/java/com/facebook/ads/sdk/IGUser.java +++ b/src/main/java/com/facebook/ads/sdk/IGUser.java @@ -143,9 +143,8 @@ public String getId() { public static IGUser loadJSON(String json, APIContext context, String header) { IGUser igUser = getGson().fromJson(json, IGUser.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igUser.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igUser.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -165,10 +164,9 @@ public static APINodeList parseResponse(String json, APIContext context, APINodeList igUsers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGUserExportForCAM.java b/src/main/java/com/facebook/ads/sdk/IGUserExportForCAM.java index 250e6175..d21f768b 100644 --- a/src/main/java/com/facebook/ads/sdk/IGUserExportForCAM.java +++ b/src/main/java/com/facebook/ads/sdk/IGUserExportForCAM.java @@ -123,9 +123,8 @@ public String getId() { public static IGUserExportForCAM loadJSON(String json, APIContext context, String header) { IGUserExportForCAM igUserExportForCAM = getGson().fromJson(json, IGUserExportForCAM.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igUserExportForCAM.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igUserExportForCAM.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList igUserExportForCAMs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGUserForIGOnlyAPI.java b/src/main/java/com/facebook/ads/sdk/IGUserForIGOnlyAPI.java index f7061f0a..46d2ea0c 100644 --- a/src/main/java/com/facebook/ads/sdk/IGUserForIGOnlyAPI.java +++ b/src/main/java/com/facebook/ads/sdk/IGUserForIGOnlyAPI.java @@ -133,9 +133,8 @@ public String getId() { public static IGUserForIGOnlyAPI loadJSON(String json, APIContext context, String header) { IGUserForIGOnlyAPI igUserForIGOnlyAPI = getGson().fromJson(json, IGUserForIGOnlyAPI.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igUserForIGOnlyAPI.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igUserForIGOnlyAPI.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -155,10 +154,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList igUserForIGOnlyAPIs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGVideoCopyrightCheckMatchesInformation.java b/src/main/java/com/facebook/ads/sdk/IGVideoCopyrightCheckMatchesInformation.java index 72da77f3..d6369ea1 100644 --- a/src/main/java/com/facebook/ads/sdk/IGVideoCopyrightCheckMatchesInformation.java +++ b/src/main/java/com/facebook/ads/sdk/IGVideoCopyrightCheckMatchesInformation.java @@ -56,9 +56,8 @@ public String getId() { public static IGVideoCopyrightCheckMatchesInformation loadJSON(String json, APIContext context, String header) { IGVideoCopyrightCheckMatchesInformation igVideoCopyrightCheckMatchesInformation = getGson().fromJson(json, IGVideoCopyrightCheckMatchesInformation.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igVideoCopyrightCheckMatchesInformation.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igVideoCopyrightCheckMatchesInformation.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse APINodeList igVideoCopyrightCheckMatchesInformations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IGVideoCopyrightCheckStatus.java b/src/main/java/com/facebook/ads/sdk/IGVideoCopyrightCheckStatus.java index 32ecbbf3..6ae7986e 100644 --- a/src/main/java/com/facebook/ads/sdk/IGVideoCopyrightCheckStatus.java +++ b/src/main/java/com/facebook/ads/sdk/IGVideoCopyrightCheckStatus.java @@ -56,9 +56,8 @@ public String getId() { public static IGVideoCopyrightCheckStatus loadJSON(String json, APIContext context, String header) { IGVideoCopyrightCheckStatus igVideoCopyrightCheckStatus = getGson().fromJson(json, IGVideoCopyrightCheckStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(igVideoCopyrightCheckStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(igVideoCopyrightCheckStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json APINodeList igVideoCopyrightCheckStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IPObject.java b/src/main/java/com/facebook/ads/sdk/IPObject.java index b9d2b15d..f8814efa 100644 --- a/src/main/java/com/facebook/ads/sdk/IPObject.java +++ b/src/main/java/com/facebook/ads/sdk/IPObject.java @@ -56,9 +56,8 @@ public String getId() { public static IPObject loadJSON(String json, APIContext context, String header) { IPObject ipObject = getGson().fromJson(json, IPObject.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(ipObject.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(ipObject.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList ipObjects = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ImageCopyright.java b/src/main/java/com/facebook/ads/sdk/ImageCopyright.java index 44cb6ced..1892192c 100644 --- a/src/main/java/com/facebook/ads/sdk/ImageCopyright.java +++ b/src/main/java/com/facebook/ads/sdk/ImageCopyright.java @@ -141,9 +141,8 @@ public String getId() { public static ImageCopyright loadJSON(String json, APIContext context, String header) { ImageCopyright imageCopyright = getGson().fromJson(json, ImageCopyright.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(imageCopyright.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(imageCopyright.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -163,10 +162,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList imageCopyrights = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ImageCopyrightDispute.java b/src/main/java/com/facebook/ads/sdk/ImageCopyrightDispute.java index bfd56375..dc5bdac2 100644 --- a/src/main/java/com/facebook/ads/sdk/ImageCopyrightDispute.java +++ b/src/main/java/com/facebook/ads/sdk/ImageCopyrightDispute.java @@ -129,9 +129,8 @@ public String getId() { public static ImageCopyrightDispute loadJSON(String json, APIContext context, String header) { ImageCopyrightDispute imageCopyrightDispute = getGson().fromJson(json, ImageCopyrightDispute.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(imageCopyrightDispute.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(imageCopyrightDispute.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList imageCopyrightDisputes = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ImageReferenceMatch.java b/src/main/java/com/facebook/ads/sdk/ImageReferenceMatch.java index 657a432a..0ebb78ae 100644 --- a/src/main/java/com/facebook/ads/sdk/ImageReferenceMatch.java +++ b/src/main/java/com/facebook/ads/sdk/ImageReferenceMatch.java @@ -145,9 +145,8 @@ public String getId() { public static ImageReferenceMatch loadJSON(String json, APIContext context, String header) { ImageReferenceMatch imageReferenceMatch = getGson().fromJson(json, ImageReferenceMatch.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(imageReferenceMatch.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(imageReferenceMatch.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -167,10 +166,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList imageReferenceMatchs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/InsightsResult.java b/src/main/java/com/facebook/ads/sdk/InsightsResult.java index 392f7ac9..f47fd318 100644 --- a/src/main/java/com/facebook/ads/sdk/InsightsResult.java +++ b/src/main/java/com/facebook/ads/sdk/InsightsResult.java @@ -66,9 +66,8 @@ public String getId() { public static InsightsResult loadJSON(String json, APIContext context, String header) { InsightsResult insightsResult = getGson().fromJson(json, InsightsResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(insightsResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(insightsResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList insightsResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/InsightsValue.java b/src/main/java/com/facebook/ads/sdk/InsightsValue.java index c7231077..f5cd93de 100644 --- a/src/main/java/com/facebook/ads/sdk/InsightsValue.java +++ b/src/main/java/com/facebook/ads/sdk/InsightsValue.java @@ -72,9 +72,8 @@ public String getId() { public static InsightsValue loadJSON(String json, APIContext context, String header) { InsightsValue insightsValue = getGson().fromJson(json, InsightsValue.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(insightsValue.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(insightsValue.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -94,10 +93,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList insightsValues = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/InstagramBoostableMediaForAccessToken.java b/src/main/java/com/facebook/ads/sdk/InstagramBoostableMediaForAccessToken.java index 308c2a1f..f9667022 100644 --- a/src/main/java/com/facebook/ads/sdk/InstagramBoostableMediaForAccessToken.java +++ b/src/main/java/com/facebook/ads/sdk/InstagramBoostableMediaForAccessToken.java @@ -56,9 +56,8 @@ public String getId() { public static InstagramBoostableMediaForAccessToken loadJSON(String json, APIContext context, String header) { InstagramBoostableMediaForAccessToken instagramBoostableMediaForAccessToken = getGson().fromJson(json, InstagramBoostableMediaForAccessToken.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(instagramBoostableMediaForAccessToken.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(instagramBoostableMediaForAccessToken.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(S APINodeList instagramBoostableMediaForAccessTokens = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/InstagramCarousel.java b/src/main/java/com/facebook/ads/sdk/InstagramCarousel.java index eacaf420..5d4b2630 100644 --- a/src/main/java/com/facebook/ads/sdk/InstagramCarousel.java +++ b/src/main/java/com/facebook/ads/sdk/InstagramCarousel.java @@ -131,9 +131,8 @@ public String getId() { public static InstagramCarousel loadJSON(String json, APIContext context, String header) { InstagramCarousel instagramCarousel = getGson().fromJson(json, InstagramCarousel.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(instagramCarousel.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(instagramCarousel.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -153,10 +152,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList instagramCarousels = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/InstagramComment.java b/src/main/java/com/facebook/ads/sdk/InstagramComment.java index 61348fe3..9db8391d 100644 --- a/src/main/java/com/facebook/ads/sdk/InstagramComment.java +++ b/src/main/java/com/facebook/ads/sdk/InstagramComment.java @@ -127,9 +127,8 @@ public String getId() { public static InstagramComment loadJSON(String json, APIContext context, String header) { InstagramComment instagramComment = getGson().fromJson(json, InstagramComment.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(instagramComment.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(instagramComment.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -149,10 +148,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList instagramComments = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/InstagramInsightsResult.java b/src/main/java/com/facebook/ads/sdk/InstagramInsightsResult.java index 7ca7c51c..5afb39cd 100644 --- a/src/main/java/com/facebook/ads/sdk/InstagramInsightsResult.java +++ b/src/main/java/com/facebook/ads/sdk/InstagramInsightsResult.java @@ -66,9 +66,8 @@ public String getId() { public static InstagramInsightsResult loadJSON(String json, APIContext context, String header) { InstagramInsightsResult instagramInsightsResult = getGson().fromJson(json, InstagramInsightsResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(instagramInsightsResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(instagramInsightsResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, AP APINodeList instagramInsightsResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/InstagramInsightsValue.java b/src/main/java/com/facebook/ads/sdk/InstagramInsightsValue.java index 5ce27b56..0cae1eab 100644 --- a/src/main/java/com/facebook/ads/sdk/InstagramInsightsValue.java +++ b/src/main/java/com/facebook/ads/sdk/InstagramInsightsValue.java @@ -56,9 +56,8 @@ public String getId() { public static InstagramInsightsValue loadJSON(String json, APIContext context, String header) { InstagramInsightsValue instagramInsightsValue = getGson().fromJson(json, InstagramInsightsValue.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(instagramInsightsValue.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(instagramInsightsValue.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, API APINodeList instagramInsightsValues = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/InstagramMedia.java b/src/main/java/com/facebook/ads/sdk/InstagramMedia.java index ede6f21d..59c77199 100644 --- a/src/main/java/com/facebook/ads/sdk/InstagramMedia.java +++ b/src/main/java/com/facebook/ads/sdk/InstagramMedia.java @@ -141,9 +141,8 @@ public String getId() { public static InstagramMedia loadJSON(String json, APIContext context, String header) { InstagramMedia instagramMedia = getGson().fromJson(json, InstagramMedia.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(instagramMedia.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(instagramMedia.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -163,10 +162,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList instagramMedias = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/InstagramRelatedProductTags.java b/src/main/java/com/facebook/ads/sdk/InstagramRelatedProductTags.java index e268020d..f2fbb88c 100644 --- a/src/main/java/com/facebook/ads/sdk/InstagramRelatedProductTags.java +++ b/src/main/java/com/facebook/ads/sdk/InstagramRelatedProductTags.java @@ -64,9 +64,8 @@ public String getId() { public static InstagramRelatedProductTags loadJSON(String json, APIContext context, String header) { InstagramRelatedProductTags instagramRelatedProductTags = getGson().fromJson(json, InstagramRelatedProductTags.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(instagramRelatedProductTags.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(instagramRelatedProductTags.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json APINodeList instagramRelatedProductTagss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/InstagramShoppingMerchantReviewMessage.java b/src/main/java/com/facebook/ads/sdk/InstagramShoppingMerchantReviewMessage.java index 53c8fd79..e0ef5678 100644 --- a/src/main/java/com/facebook/ads/sdk/InstagramShoppingMerchantReviewMessage.java +++ b/src/main/java/com/facebook/ads/sdk/InstagramShoppingMerchantReviewMessage.java @@ -56,9 +56,8 @@ public String getId() { public static InstagramShoppingMerchantReviewMessage loadJSON(String json, APIContext context, String header) { InstagramShoppingMerchantReviewMessage instagramShoppingMerchantReviewMessage = getGson().fromJson(json, InstagramShoppingMerchantReviewMessage.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(instagramShoppingMerchantReviewMessage.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(instagramShoppingMerchantReviewMessage.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse( APINodeList instagramShoppingMerchantReviewMessages = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/InstagramUser.java b/src/main/java/com/facebook/ads/sdk/InstagramUser.java index 72180abd..8036bf8d 100644 --- a/src/main/java/com/facebook/ads/sdk/InstagramUser.java +++ b/src/main/java/com/facebook/ads/sdk/InstagramUser.java @@ -133,9 +133,8 @@ public String getId() { public static InstagramUser loadJSON(String json, APIContext context, String header) { InstagramUser instagramUser = getGson().fromJson(json, InstagramUser.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(instagramUser.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(instagramUser.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -155,10 +154,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList instagramUsers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/InstagramVideoMetadata.java b/src/main/java/com/facebook/ads/sdk/InstagramVideoMetadata.java index 4cc6164f..94e08b29 100644 --- a/src/main/java/com/facebook/ads/sdk/InstagramVideoMetadata.java +++ b/src/main/java/com/facebook/ads/sdk/InstagramVideoMetadata.java @@ -58,9 +58,8 @@ public String getId() { public static InstagramVideoMetadata loadJSON(String json, APIContext context, String header) { InstagramVideoMetadata instagramVideoMetadata = getGson().fromJson(json, InstagramVideoMetadata.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(instagramVideoMetadata.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(instagramVideoMetadata.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, API APINodeList instagramVideoMetadatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/InstantArticleInsightsQueryResult.java b/src/main/java/com/facebook/ads/sdk/InstantArticleInsightsQueryResult.java index 677c8fcc..5569879d 100644 --- a/src/main/java/com/facebook/ads/sdk/InstantArticleInsightsQueryResult.java +++ b/src/main/java/com/facebook/ads/sdk/InstantArticleInsightsQueryResult.java @@ -60,9 +60,8 @@ public String getId() { public static InstantArticleInsightsQueryResult loadJSON(String json, APIContext context, String header) { InstantArticleInsightsQueryResult instantArticleInsightsQueryResult = getGson().fromJson(json, InstantArticleInsightsQueryResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(instantArticleInsightsQueryResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(instantArticleInsightsQueryResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(Strin APINodeList instantArticleInsightsQueryResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/IosAppLink.java b/src/main/java/com/facebook/ads/sdk/IosAppLink.java index cdf741bf..6051b378 100644 --- a/src/main/java/com/facebook/ads/sdk/IosAppLink.java +++ b/src/main/java/com/facebook/ads/sdk/IosAppLink.java @@ -58,9 +58,8 @@ public String getId() { public static IosAppLink loadJSON(String json, APIContext context, String header) { IosAppLink iosAppLink = getGson().fromJson(json, IosAppLink.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(iosAppLink.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(iosAppLink.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList iosAppLinks = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/JobOpening.java b/src/main/java/com/facebook/ads/sdk/JobOpening.java index d69090a5..aa8d43d7 100644 --- a/src/main/java/com/facebook/ads/sdk/JobOpening.java +++ b/src/main/java/com/facebook/ads/sdk/JobOpening.java @@ -157,9 +157,8 @@ public String getId() { public static JobOpening loadJSON(String json, APIContext context, String header) { JobOpening jobOpening = getGson().fromJson(json, JobOpening.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(jobOpening.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(jobOpening.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -179,10 +178,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList jobOpenings = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/KeyValue.java b/src/main/java/com/facebook/ads/sdk/KeyValue.java index 70b86f62..c233f8aa 100644 --- a/src/main/java/com/facebook/ads/sdk/KeyValue.java +++ b/src/main/java/com/facebook/ads/sdk/KeyValue.java @@ -56,9 +56,8 @@ public String getId() { public static KeyValue loadJSON(String json, APIContext context, String header) { KeyValue keyValue = getGson().fromJson(json, KeyValue.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(keyValue.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(keyValue.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList keyValues = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/KeywordDeliveryReport.java b/src/main/java/com/facebook/ads/sdk/KeywordDeliveryReport.java index 630ce37c..cd1151be 100644 --- a/src/main/java/com/facebook/ads/sdk/KeywordDeliveryReport.java +++ b/src/main/java/com/facebook/ads/sdk/KeywordDeliveryReport.java @@ -70,9 +70,8 @@ public String getId() { public static KeywordDeliveryReport loadJSON(String json, APIContext context, String header) { KeywordDeliveryReport keywordDeliveryReport = getGson().fromJson(json, KeywordDeliveryReport.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(keywordDeliveryReport.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(keywordDeliveryReport.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList keywordDeliveryReports = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Lead.java b/src/main/java/com/facebook/ads/sdk/Lead.java index cedbbfff..deed0dc1 100644 --- a/src/main/java/com/facebook/ads/sdk/Lead.java +++ b/src/main/java/com/facebook/ads/sdk/Lead.java @@ -149,9 +149,8 @@ public String getId() { public static Lead loadJSON(String json, APIContext context, String header) { Lead lead = getGson().fromJson(json, Lead.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(lead.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(lead.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -171,10 +170,9 @@ public static APINodeList parseResponse(String json, APIContext context, A APINodeList leads = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenAppointmentBookingInfo.java b/src/main/java/com/facebook/ads/sdk/LeadGenAppointmentBookingInfo.java index 73444c78..20284eba 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenAppointmentBookingInfo.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenAppointmentBookingInfo.java @@ -58,9 +58,8 @@ public String getId() { public static LeadGenAppointmentBookingInfo loadJSON(String json, APIContext context, String header) { LeadGenAppointmentBookingInfo leadGenAppointmentBookingInfo = getGson().fromJson(json, LeadGenAppointmentBookingInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenAppointmentBookingInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenAppointmentBookingInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String js APINodeList leadGenAppointmentBookingInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenAppointmentSlotsByDay.java b/src/main/java/com/facebook/ads/sdk/LeadGenAppointmentSlotsByDay.java index 5cc0288d..8b2fd148 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenAppointmentSlotsByDay.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenAppointmentSlotsByDay.java @@ -56,9 +56,8 @@ public String getId() { public static LeadGenAppointmentSlotsByDay loadJSON(String json, APIContext context, String header) { LeadGenAppointmentSlotsByDay leadGenAppointmentSlotsByDay = getGson().fromJson(json, LeadGenAppointmentSlotsByDay.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenAppointmentSlotsByDay.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenAppointmentSlotsByDay.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String jso APINodeList leadGenAppointmentSlotsByDays = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenAppointmentTimeSlot.java b/src/main/java/com/facebook/ads/sdk/LeadGenAppointmentTimeSlot.java index 19883558..8697498b 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenAppointmentTimeSlot.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenAppointmentTimeSlot.java @@ -56,9 +56,8 @@ public String getId() { public static LeadGenAppointmentTimeSlot loadJSON(String json, APIContext context, String header) { LeadGenAppointmentTimeSlot leadGenAppointmentTimeSlot = getGson().fromJson(json, LeadGenAppointmentTimeSlot.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenAppointmentTimeSlot.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenAppointmentTimeSlot.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APINodeList leadGenAppointmentTimeSlots = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenConditionalQuestionsGroupChoices.java b/src/main/java/com/facebook/ads/sdk/LeadGenConditionalQuestionsGroupChoices.java index 5267e420..dd30e058 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenConditionalQuestionsGroupChoices.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenConditionalQuestionsGroupChoices.java @@ -58,9 +58,8 @@ public String getId() { public static LeadGenConditionalQuestionsGroupChoices loadJSON(String json, APIContext context, String header) { LeadGenConditionalQuestionsGroupChoices leadGenConditionalQuestionsGroupChoices = getGson().fromJson(json, LeadGenConditionalQuestionsGroupChoices.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenConditionalQuestionsGroupChoices.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenConditionalQuestionsGroupChoices.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse APINodeList leadGenConditionalQuestionsGroupChoicess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenConditionalQuestionsGroupQuestions.java b/src/main/java/com/facebook/ads/sdk/LeadGenConditionalQuestionsGroupQuestions.java index c1c40766..25d3f89d 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenConditionalQuestionsGroupQuestions.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenConditionalQuestionsGroupQuestions.java @@ -58,9 +58,8 @@ public String getId() { public static LeadGenConditionalQuestionsGroupQuestions loadJSON(String json, APIContext context, String header) { LeadGenConditionalQuestionsGroupQuestions leadGenConditionalQuestionsGroupQuestions = getGson().fromJson(json, LeadGenConditionalQuestionsGroupQuestions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenConditionalQuestionsGroupQuestions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenConditionalQuestionsGroupQuestions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseRespon APINodeList leadGenConditionalQuestionsGroupQuestionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenContextCard.java b/src/main/java/com/facebook/ads/sdk/LeadGenContextCard.java index 794c8265..92e282f8 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenContextCard.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenContextCard.java @@ -64,9 +64,8 @@ public String getId() { public static LeadGenContextCard loadJSON(String json, APIContext context, String header) { LeadGenContextCard leadGenContextCard = getGson().fromJson(json, LeadGenContextCard.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenContextCard.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenContextCard.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList leadGenContextCards = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenCustomDisclaimer.java b/src/main/java/com/facebook/ads/sdk/LeadGenCustomDisclaimer.java index f875980b..85eae45b 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenCustomDisclaimer.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenCustomDisclaimer.java @@ -58,9 +58,8 @@ public String getId() { public static LeadGenCustomDisclaimer loadJSON(String json, APIContext context, String header) { LeadGenCustomDisclaimer leadGenCustomDisclaimer = getGson().fromJson(json, LeadGenCustomDisclaimer.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenCustomDisclaimer.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenCustomDisclaimer.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, AP APINodeList leadGenCustomDisclaimers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenCustomDisclaimerBody.java b/src/main/java/com/facebook/ads/sdk/LeadGenCustomDisclaimerBody.java index 4417f0e5..90f4618e 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenCustomDisclaimerBody.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenCustomDisclaimerBody.java @@ -56,9 +56,8 @@ public String getId() { public static LeadGenCustomDisclaimerBody loadJSON(String json, APIContext context, String header) { LeadGenCustomDisclaimerBody leadGenCustomDisclaimerBody = getGson().fromJson(json, LeadGenCustomDisclaimerBody.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenCustomDisclaimerBody.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenCustomDisclaimerBody.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json APINodeList leadGenCustomDisclaimerBodys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenDataDraft.java b/src/main/java/com/facebook/ads/sdk/LeadGenDataDraft.java index 161bc3ad..09cabdf8 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenDataDraft.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenDataDraft.java @@ -141,9 +141,8 @@ public String getId() { public static LeadGenDataDraft loadJSON(String json, APIContext context, String header) { LeadGenDataDraft leadGenDataDraft = getGson().fromJson(json, LeadGenDataDraft.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenDataDraft.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenDataDraft.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -163,10 +162,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList leadGenDataDrafts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenDirectCRMIntegrationConfig.java b/src/main/java/com/facebook/ads/sdk/LeadGenDirectCRMIntegrationConfig.java index 5baca307..1096dab0 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenDirectCRMIntegrationConfig.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenDirectCRMIntegrationConfig.java @@ -127,9 +127,8 @@ public String getId() { public static LeadGenDirectCRMIntegrationConfig loadJSON(String json, APIContext context, String header) { LeadGenDirectCRMIntegrationConfig leadGenDirectCRMIntegrationConfig = getGson().fromJson(json, LeadGenDirectCRMIntegrationConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenDirectCRMIntegrationConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenDirectCRMIntegrationConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -149,10 +148,9 @@ public static APINodeList parseResponse(Strin APINodeList leadGenDirectCRMIntegrationConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenDraftQuestion.java b/src/main/java/com/facebook/ads/sdk/LeadGenDraftQuestion.java index 402fd9b2..35a7af83 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenDraftQuestion.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenDraftQuestion.java @@ -68,9 +68,8 @@ public String getId() { public static LeadGenDraftQuestion loadJSON(String json, APIContext context, String header) { LeadGenDraftQuestion leadGenDraftQuestion = getGson().fromJson(json, LeadGenDraftQuestion.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenDraftQuestion.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenDraftQuestion.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList leadGenDraftQuestions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenFormPreviewDetails.java b/src/main/java/com/facebook/ads/sdk/LeadGenFormPreviewDetails.java index 6c7ff8b2..d04ae099 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenFormPreviewDetails.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenFormPreviewDetails.java @@ -126,9 +126,8 @@ public String getId() { public static LeadGenFormPreviewDetails loadJSON(String json, APIContext context, String header) { LeadGenFormPreviewDetails leadGenFormPreviewDetails = getGson().fromJson(json, LeadGenFormPreviewDetails.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenFormPreviewDetails.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenFormPreviewDetails.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -148,10 +147,9 @@ public static APINodeList parseResponse(String json, APINodeList leadGenFormPreviewDetailss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenLegalContent.java b/src/main/java/com/facebook/ads/sdk/LeadGenLegalContent.java index 2b30cd11..0c69fd80 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenLegalContent.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenLegalContent.java @@ -58,9 +58,8 @@ public String getId() { public static LeadGenLegalContent loadJSON(String json, APIContext context, String header) { LeadGenLegalContent leadGenLegalContent = getGson().fromJson(json, LeadGenLegalContent.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenLegalContent.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenLegalContent.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList leadGenLegalContents = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenLegalContentCheckbox.java b/src/main/java/com/facebook/ads/sdk/LeadGenLegalContentCheckbox.java index da210920..9e0bfa5c 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenLegalContentCheckbox.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenLegalContentCheckbox.java @@ -62,9 +62,8 @@ public String getId() { public static LeadGenLegalContentCheckbox loadJSON(String json, APIContext context, String header) { LeadGenLegalContentCheckbox leadGenLegalContentCheckbox = getGson().fromJson(json, LeadGenLegalContentCheckbox.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenLegalContentCheckbox.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenLegalContentCheckbox.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json APINodeList leadGenLegalContentCheckboxs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenPostSubmissionCheckResult.java b/src/main/java/com/facebook/ads/sdk/LeadGenPostSubmissionCheckResult.java index 22d048b7..be18007b 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenPostSubmissionCheckResult.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenPostSubmissionCheckResult.java @@ -58,9 +58,8 @@ public String getId() { public static LeadGenPostSubmissionCheckResult loadJSON(String json, APIContext context, String header) { LeadGenPostSubmissionCheckResult leadGenPostSubmissionCheckResult = getGson().fromJson(json, LeadGenPostSubmissionCheckResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenPostSubmissionCheckResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenPostSubmissionCheckResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String APINodeList leadGenPostSubmissionCheckResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenPrivacyPolicy.java b/src/main/java/com/facebook/ads/sdk/LeadGenPrivacyPolicy.java index 7635ce61..553dea6f 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenPrivacyPolicy.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenPrivacyPolicy.java @@ -56,9 +56,8 @@ public String getId() { public static LeadGenPrivacyPolicy loadJSON(String json, APIContext context, String header) { LeadGenPrivacyPolicy leadGenPrivacyPolicy = getGson().fromJson(json, LeadGenPrivacyPolicy.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenPrivacyPolicy.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenPrivacyPolicy.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList leadGenPrivacyPolicys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenQuestion.java b/src/main/java/com/facebook/ads/sdk/LeadGenQuestion.java index 65d18f30..9975782d 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenQuestion.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenQuestion.java @@ -70,9 +70,8 @@ public String getId() { public static LeadGenQuestion loadJSON(String json, APIContext context, String header) { LeadGenQuestion leadGenQuestion = getGson().fromJson(json, LeadGenQuestion.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenQuestion.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenQuestion.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList leadGenQuestions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenQuestionOption.java b/src/main/java/com/facebook/ads/sdk/LeadGenQuestionOption.java index a9263084..c724f01b 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenQuestionOption.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenQuestionOption.java @@ -56,9 +56,8 @@ public String getId() { public static LeadGenQuestionOption loadJSON(String json, APIContext context, String header) { LeadGenQuestionOption leadGenQuestionOption = getGson().fromJson(json, LeadGenQuestionOption.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenQuestionOption.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenQuestionOption.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList leadGenQuestionOptions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenThankYouPage.java b/src/main/java/com/facebook/ads/sdk/LeadGenThankYouPage.java index a9c9241f..7e3ee937 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenThankYouPage.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenThankYouPage.java @@ -74,9 +74,8 @@ public String getId() { public static LeadGenThankYouPage loadJSON(String json, APIContext context, String header) { LeadGenThankYouPage leadGenThankYouPage = getGson().fromJson(json, LeadGenThankYouPage.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenThankYouPage.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenThankYouPage.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -96,10 +95,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList leadGenThankYouPages = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenThankYouPageGatedFile.java b/src/main/java/com/facebook/ads/sdk/LeadGenThankYouPageGatedFile.java index 623b65f3..f612a557 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenThankYouPageGatedFile.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenThankYouPageGatedFile.java @@ -60,9 +60,8 @@ public String getId() { public static LeadGenThankYouPageGatedFile loadJSON(String json, APIContext context, String header) { LeadGenThankYouPageGatedFile leadGenThankYouPageGatedFile = getGson().fromJson(json, LeadGenThankYouPageGatedFile.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenThankYouPageGatedFile.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenThankYouPageGatedFile.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String jso APINodeList leadGenThankYouPageGatedFiles = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenThankYouPageGatedPromo.java b/src/main/java/com/facebook/ads/sdk/LeadGenThankYouPageGatedPromo.java index 6a9d1a09..0dec2bcd 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenThankYouPageGatedPromo.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenThankYouPageGatedPromo.java @@ -58,9 +58,8 @@ public String getId() { public static LeadGenThankYouPageGatedPromo loadJSON(String json, APIContext context, String header) { LeadGenThankYouPageGatedPromo leadGenThankYouPageGatedPromo = getGson().fromJson(json, LeadGenThankYouPageGatedPromo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenThankYouPageGatedPromo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenThankYouPageGatedPromo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String js APINodeList leadGenThankYouPageGatedPromos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadGenURLEntityAtRanges.java b/src/main/java/com/facebook/ads/sdk/LeadGenURLEntityAtRanges.java index c6db4d59..2beae12f 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadGenURLEntityAtRanges.java +++ b/src/main/java/com/facebook/ads/sdk/LeadGenURLEntityAtRanges.java @@ -58,9 +58,8 @@ public String getId() { public static LeadGenURLEntityAtRanges loadJSON(String json, APIContext context, String header) { LeadGenURLEntityAtRanges leadGenURLEntityAtRanges = getGson().fromJson(json, LeadGenURLEntityAtRanges.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadGenURLEntityAtRanges.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadGenURLEntityAtRanges.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, A APINodeList leadGenURLEntityAtRangess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LeadgenForm.java b/src/main/java/com/facebook/ads/sdk/LeadgenForm.java index 9485360a..3bfeede6 100644 --- a/src/main/java/com/facebook/ads/sdk/LeadgenForm.java +++ b/src/main/java/com/facebook/ads/sdk/LeadgenForm.java @@ -157,9 +157,8 @@ public String getId() { public static LeadgenForm loadJSON(String json, APIContext context, String header) { LeadgenForm leadgenForm = getGson().fromJson(json, LeadgenForm.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(leadgenForm.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(leadgenForm.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -179,10 +178,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList leadgenForms = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LifeEvent.java b/src/main/java/com/facebook/ads/sdk/LifeEvent.java index 646893d2..65c2268d 100644 --- a/src/main/java/com/facebook/ads/sdk/LifeEvent.java +++ b/src/main/java/com/facebook/ads/sdk/LifeEvent.java @@ -127,9 +127,8 @@ public String getId() { public static LifeEvent loadJSON(String json, APIContext context, String header) { LifeEvent lifeEvent = getGson().fromJson(json, LifeEvent.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(lifeEvent.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(lifeEvent.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -149,10 +148,9 @@ public static APINodeList parseResponse(String json, APIContext conte APINodeList lifeEvents = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Link.java b/src/main/java/com/facebook/ads/sdk/Link.java index cff5f3ba..a1b6f093 100644 --- a/src/main/java/com/facebook/ads/sdk/Link.java +++ b/src/main/java/com/facebook/ads/sdk/Link.java @@ -135,9 +135,8 @@ public String getId() { public static Link loadJSON(String json, APIContext context, String header) { Link link = getGson().fromJson(json, Link.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(link.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(link.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -157,10 +156,9 @@ public static APINodeList parseResponse(String json, APIContext context, A APINodeList links = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LinkedInstagramAccountData.java b/src/main/java/com/facebook/ads/sdk/LinkedInstagramAccountData.java index 852ce63f..dc1e1384 100644 --- a/src/main/java/com/facebook/ads/sdk/LinkedInstagramAccountData.java +++ b/src/main/java/com/facebook/ads/sdk/LinkedInstagramAccountData.java @@ -64,9 +64,8 @@ public String getId() { public static LinkedInstagramAccountData loadJSON(String json, APIContext context, String header) { LinkedInstagramAccountData linkedInstagramAccountData = getGson().fromJson(json, LinkedInstagramAccountData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(linkedInstagramAccountData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(linkedInstagramAccountData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APINodeList linkedInstagramAccountDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LiveVideo.java b/src/main/java/com/facebook/ads/sdk/LiveVideo.java index a6ee3373..c1da8f4c 100644 --- a/src/main/java/com/facebook/ads/sdk/LiveVideo.java +++ b/src/main/java/com/facebook/ads/sdk/LiveVideo.java @@ -165,9 +165,8 @@ public String getId() { public static LiveVideo loadJSON(String json, APIContext context, String header) { LiveVideo liveVideo = getGson().fromJson(json, LiveVideo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(liveVideo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(liveVideo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -187,10 +186,9 @@ public static APINodeList parseResponse(String json, APIContext conte APINodeList liveVideos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LiveVideoAdBreakConfig.java b/src/main/java/com/facebook/ads/sdk/LiveVideoAdBreakConfig.java index b664adc1..6382f17a 100644 --- a/src/main/java/com/facebook/ads/sdk/LiveVideoAdBreakConfig.java +++ b/src/main/java/com/facebook/ads/sdk/LiveVideoAdBreakConfig.java @@ -72,9 +72,8 @@ public String getId() { public static LiveVideoAdBreakConfig loadJSON(String json, APIContext context, String header) { LiveVideoAdBreakConfig liveVideoAdBreakConfig = getGson().fromJson(json, LiveVideoAdBreakConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(liveVideoAdBreakConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(liveVideoAdBreakConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -94,10 +93,9 @@ public static APINodeList parseResponse(String json, API APINodeList liveVideoAdBreakConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LiveVideoError.java b/src/main/java/com/facebook/ads/sdk/LiveVideoError.java index c281c2e3..2ab62c22 100644 --- a/src/main/java/com/facebook/ads/sdk/LiveVideoError.java +++ b/src/main/java/com/facebook/ads/sdk/LiveVideoError.java @@ -121,9 +121,8 @@ public String getId() { public static LiveVideoError loadJSON(String json, APIContext context, String header) { LiveVideoError liveVideoError = getGson().fromJson(json, LiveVideoError.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(liveVideoError.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(liveVideoError.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList liveVideoErrors = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LiveVideoInputStream.java b/src/main/java/com/facebook/ads/sdk/LiveVideoInputStream.java index eafadcf4..ff1be5ff 100644 --- a/src/main/java/com/facebook/ads/sdk/LiveVideoInputStream.java +++ b/src/main/java/com/facebook/ads/sdk/LiveVideoInputStream.java @@ -127,9 +127,8 @@ public String getId() { public static LiveVideoInputStream loadJSON(String json, APIContext context, String header) { LiveVideoInputStream liveVideoInputStream = getGson().fromJson(json, LiveVideoInputStream.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(liveVideoInputStream.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(liveVideoInputStream.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -149,10 +148,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList liveVideoInputStreams = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LiveVideoRecommendedEncoderSettings.java b/src/main/java/com/facebook/ads/sdk/LiveVideoRecommendedEncoderSettings.java index 12999abc..afe5b2b8 100644 --- a/src/main/java/com/facebook/ads/sdk/LiveVideoRecommendedEncoderSettings.java +++ b/src/main/java/com/facebook/ads/sdk/LiveVideoRecommendedEncoderSettings.java @@ -58,9 +58,8 @@ public String getId() { public static LiveVideoRecommendedEncoderSettings loadJSON(String json, APIContext context, String header) { LiveVideoRecommendedEncoderSettings liveVideoRecommendedEncoderSettings = getGson().fromJson(json, LiveVideoRecommendedEncoderSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(liveVideoRecommendedEncoderSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(liveVideoRecommendedEncoderSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(Str APINodeList liveVideoRecommendedEncoderSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LiveVideoTargeting.java b/src/main/java/com/facebook/ads/sdk/LiveVideoTargeting.java index 21c1101f..1cce9755 100644 --- a/src/main/java/com/facebook/ads/sdk/LiveVideoTargeting.java +++ b/src/main/java/com/facebook/ads/sdk/LiveVideoTargeting.java @@ -60,9 +60,8 @@ public String getId() { public static LiveVideoTargeting loadJSON(String json, APIContext context, String header) { LiveVideoTargeting liveVideoTargeting = getGson().fromJson(json, LiveVideoTargeting.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(liveVideoTargeting.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(liveVideoTargeting.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList liveVideoTargetings = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LocalServiceBusiness.java b/src/main/java/com/facebook/ads/sdk/LocalServiceBusiness.java index 5f2be3cd..3671c4f6 100644 --- a/src/main/java/com/facebook/ads/sdk/LocalServiceBusiness.java +++ b/src/main/java/com/facebook/ads/sdk/LocalServiceBusiness.java @@ -191,9 +191,8 @@ public String getId() { public static LocalServiceBusiness loadJSON(String json, APIContext context, String header) { LocalServiceBusiness localServiceBusiness = getGson().fromJson(json, LocalServiceBusiness.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(localServiceBusiness.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(localServiceBusiness.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -213,10 +212,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList localServiceBusinesss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Location.java b/src/main/java/com/facebook/ads/sdk/Location.java index 7347fa27..fa48370e 100644 --- a/src/main/java/com/facebook/ads/sdk/Location.java +++ b/src/main/java/com/facebook/ads/sdk/Location.java @@ -78,9 +78,8 @@ public String getId() { public static Location loadJSON(String json, APIContext context, String header) { Location location = getGson().fromJson(json, Location.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(location.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(location.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -100,10 +99,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList locations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LookalikeSpec.java b/src/main/java/com/facebook/ads/sdk/LookalikeSpec.java index 150250ba..2fb3bfc4 100644 --- a/src/main/java/com/facebook/ads/sdk/LookalikeSpec.java +++ b/src/main/java/com/facebook/ads/sdk/LookalikeSpec.java @@ -76,9 +76,8 @@ public String getId() { public static LookalikeSpec loadJSON(String json, APIContext context, String header) { LookalikeSpec lookalikeSpec = getGson().fromJson(json, LookalikeSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(lookalikeSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(lookalikeSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -98,10 +97,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList lookalikeSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/LoomConfig.java b/src/main/java/com/facebook/ads/sdk/LoomConfig.java index 623c2235..61ba3d4b 100644 --- a/src/main/java/com/facebook/ads/sdk/LoomConfig.java +++ b/src/main/java/com/facebook/ads/sdk/LoomConfig.java @@ -54,9 +54,8 @@ public String getId() { public static LoomConfig loadJSON(String json, APIContext context, String header) { LoomConfig loomConfig = getGson().fromJson(json, LoomConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(loomConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(loomConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList loomConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MCExperienceConfigForApi.java b/src/main/java/com/facebook/ads/sdk/MCExperienceConfigForApi.java index 8944386f..b047cec3 100644 --- a/src/main/java/com/facebook/ads/sdk/MCExperienceConfigForApi.java +++ b/src/main/java/com/facebook/ads/sdk/MCExperienceConfigForApi.java @@ -58,9 +58,8 @@ public String getId() { public static MCExperienceConfigForApi loadJSON(String json, APIContext context, String header) { MCExperienceConfigForApi mcExperienceConfigForApi = getGson().fromJson(json, MCExperienceConfigForApi.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(mcExperienceConfigForApi.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(mcExperienceConfigForApi.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, A APINodeList mcExperienceConfigForApis = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MIXInsightsResult.java b/src/main/java/com/facebook/ads/sdk/MIXInsightsResult.java index de3608ff..94dae551 100644 --- a/src/main/java/com/facebook/ads/sdk/MIXInsightsResult.java +++ b/src/main/java/com/facebook/ads/sdk/MIXInsightsResult.java @@ -94,9 +94,8 @@ public String getId() { public static MIXInsightsResult loadJSON(String json, APIContext context, String header) { MIXInsightsResult mixInsightsResult = getGson().fromJson(json, MIXInsightsResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(mixInsightsResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(mixInsightsResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -116,10 +115,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList mixInsightsResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MailingAddress.java b/src/main/java/com/facebook/ads/sdk/MailingAddress.java index f8ed607c..ae6fb32c 100644 --- a/src/main/java/com/facebook/ads/sdk/MailingAddress.java +++ b/src/main/java/com/facebook/ads/sdk/MailingAddress.java @@ -127,9 +127,8 @@ public String getId() { public static MailingAddress loadJSON(String json, APIContext context, String header) { MailingAddress mailingAddress = getGson().fromJson(json, MailingAddress.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(mailingAddress.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(mailingAddress.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -149,10 +148,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList mailingAddresss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ManagedPartnerBusiness.java b/src/main/java/com/facebook/ads/sdk/ManagedPartnerBusiness.java index b2e48e3a..dc38e2be 100644 --- a/src/main/java/com/facebook/ads/sdk/ManagedPartnerBusiness.java +++ b/src/main/java/com/facebook/ads/sdk/ManagedPartnerBusiness.java @@ -66,9 +66,8 @@ public String getId() { public static ManagedPartnerBusiness loadJSON(String json, APIContext context, String header) { ManagedPartnerBusiness managedPartnerBusiness = getGson().fromJson(json, ManagedPartnerBusiness.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(managedPartnerBusiness.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(managedPartnerBusiness.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, API APINodeList managedPartnerBusinesss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ManagedPartnerExtendedCredit.java b/src/main/java/com/facebook/ads/sdk/ManagedPartnerExtendedCredit.java index b49903a0..1238c0a4 100644 --- a/src/main/java/com/facebook/ads/sdk/ManagedPartnerExtendedCredit.java +++ b/src/main/java/com/facebook/ads/sdk/ManagedPartnerExtendedCredit.java @@ -58,9 +58,8 @@ public String getId() { public static ManagedPartnerExtendedCredit loadJSON(String json, APIContext context, String header) { ManagedPartnerExtendedCredit managedPartnerExtendedCredit = getGson().fromJson(json, ManagedPartnerExtendedCredit.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(managedPartnerExtendedCredit.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(managedPartnerExtendedCredit.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String jso APINodeList managedPartnerExtendedCredits = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MarketingMessageTargeting.java b/src/main/java/com/facebook/ads/sdk/MarketingMessageTargeting.java index 0672b325..b94dcbd6 100644 --- a/src/main/java/com/facebook/ads/sdk/MarketingMessageTargeting.java +++ b/src/main/java/com/facebook/ads/sdk/MarketingMessageTargeting.java @@ -62,9 +62,8 @@ public String getId() { public static MarketingMessageTargeting loadJSON(String json, APIContext context, String header) { MarketingMessageTargeting marketingMessageTargeting = getGson().fromJson(json, MarketingMessageTargeting.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(marketingMessageTargeting.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(marketingMessageTargeting.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APINodeList marketingMessageTargetings = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/McomInvoiceBankAccount.java b/src/main/java/com/facebook/ads/sdk/McomInvoiceBankAccount.java index cf37ad46..0f8d86b6 100644 --- a/src/main/java/com/facebook/ads/sdk/McomInvoiceBankAccount.java +++ b/src/main/java/com/facebook/ads/sdk/McomInvoiceBankAccount.java @@ -60,9 +60,8 @@ public String getId() { public static McomInvoiceBankAccount loadJSON(String json, APIContext context, String header) { McomInvoiceBankAccount mcomInvoiceBankAccount = getGson().fromJson(json, McomInvoiceBankAccount.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(mcomInvoiceBankAccount.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(mcomInvoiceBankAccount.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, API APINodeList mcomInvoiceBankAccounts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/McomInvoiceDetails.java b/src/main/java/com/facebook/ads/sdk/McomInvoiceDetails.java index c7dab1b2..a9e9f2aa 100644 --- a/src/main/java/com/facebook/ads/sdk/McomInvoiceDetails.java +++ b/src/main/java/com/facebook/ads/sdk/McomInvoiceDetails.java @@ -90,9 +90,8 @@ public String getId() { public static McomInvoiceDetails loadJSON(String json, APIContext context, String header) { McomInvoiceDetails mcomInvoiceDetails = getGson().fromJson(json, McomInvoiceDetails.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(mcomInvoiceDetails.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(mcomInvoiceDetails.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -112,10 +111,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList mcomInvoiceDetailss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/McomInvoiceLists.java b/src/main/java/com/facebook/ads/sdk/McomInvoiceLists.java index 190c032c..b8e6e0b7 100644 --- a/src/main/java/com/facebook/ads/sdk/McomInvoiceLists.java +++ b/src/main/java/com/facebook/ads/sdk/McomInvoiceLists.java @@ -58,9 +58,8 @@ public String getId() { public static McomInvoiceLists loadJSON(String json, APIContext context, String header) { McomInvoiceLists mcomInvoiceLists = getGson().fromJson(json, McomInvoiceLists.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(mcomInvoiceLists.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(mcomInvoiceLists.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList mcomInvoiceListss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/McomInvoiceStatus.java b/src/main/java/com/facebook/ads/sdk/McomInvoiceStatus.java index 7cbb100a..e8589930 100644 --- a/src/main/java/com/facebook/ads/sdk/McomInvoiceStatus.java +++ b/src/main/java/com/facebook/ads/sdk/McomInvoiceStatus.java @@ -76,9 +76,8 @@ public String getId() { public static McomInvoiceStatus loadJSON(String json, APIContext context, String header) { McomInvoiceStatus mcomInvoiceStatus = getGson().fromJson(json, McomInvoiceStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(mcomInvoiceStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(mcomInvoiceStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -98,10 +97,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList mcomInvoiceStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/McomOnboardingStatus.java b/src/main/java/com/facebook/ads/sdk/McomOnboardingStatus.java index 384ac8ea..e834cfd5 100644 --- a/src/main/java/com/facebook/ads/sdk/McomOnboardingStatus.java +++ b/src/main/java/com/facebook/ads/sdk/McomOnboardingStatus.java @@ -56,9 +56,8 @@ public String getId() { public static McomOnboardingStatus loadJSON(String json, APIContext context, String header) { McomOnboardingStatus mcomOnboardingStatus = getGson().fromJson(json, McomOnboardingStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(mcomOnboardingStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(mcomOnboardingStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList mcomOnboardingStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/McomPayouts.java b/src/main/java/com/facebook/ads/sdk/McomPayouts.java index a08f67b8..37ea79d5 100644 --- a/src/main/java/com/facebook/ads/sdk/McomPayouts.java +++ b/src/main/java/com/facebook/ads/sdk/McomPayouts.java @@ -66,9 +66,8 @@ public String getId() { public static McomPayouts loadJSON(String json, APIContext context, String header) { McomPayouts mcomPayouts = getGson().fromJson(json, McomPayouts.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(mcomPayouts.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(mcomPayouts.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList mcomPayoutss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MeasurementReport.java b/src/main/java/com/facebook/ads/sdk/MeasurementReport.java index 0777c168..bfed84a8 100644 --- a/src/main/java/com/facebook/ads/sdk/MeasurementReport.java +++ b/src/main/java/com/facebook/ads/sdk/MeasurementReport.java @@ -121,9 +121,8 @@ public String getId() { public static MeasurementReport loadJSON(String json, APIContext context, String header) { MeasurementReport measurementReport = getGson().fromJson(json, MeasurementReport.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(measurementReport.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(measurementReport.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList measurementReports = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MediaCopyrightAttribution.java b/src/main/java/com/facebook/ads/sdk/MediaCopyrightAttribution.java index 053bb827..86c9aba0 100644 --- a/src/main/java/com/facebook/ads/sdk/MediaCopyrightAttribution.java +++ b/src/main/java/com/facebook/ads/sdk/MediaCopyrightAttribution.java @@ -143,9 +143,8 @@ public String getId() { public static MediaCopyrightAttribution loadJSON(String json, APIContext context, String header) { MediaCopyrightAttribution mediaCopyrightAttribution = getGson().fromJson(json, MediaCopyrightAttribution.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(mediaCopyrightAttribution.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(mediaCopyrightAttribution.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -165,10 +164,9 @@ public static APINodeList parseResponse(String json, APINodeList mediaCopyrightAttributions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MediaCopyrightUpdateRecord.java b/src/main/java/com/facebook/ads/sdk/MediaCopyrightUpdateRecord.java index 376d8b27..d611c261 100644 --- a/src/main/java/com/facebook/ads/sdk/MediaCopyrightUpdateRecord.java +++ b/src/main/java/com/facebook/ads/sdk/MediaCopyrightUpdateRecord.java @@ -125,9 +125,8 @@ public String getId() { public static MediaCopyrightUpdateRecord loadJSON(String json, APIContext context, String header) { MediaCopyrightUpdateRecord mediaCopyrightUpdateRecord = getGson().fromJson(json, MediaCopyrightUpdateRecord.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(mediaCopyrightUpdateRecord.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(mediaCopyrightUpdateRecord.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, APINodeList mediaCopyrightUpdateRecords = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MediaFingerprint.java b/src/main/java/com/facebook/ads/sdk/MediaFingerprint.java index 1853de92..d81d0a85 100644 --- a/src/main/java/com/facebook/ads/sdk/MediaFingerprint.java +++ b/src/main/java/com/facebook/ads/sdk/MediaFingerprint.java @@ -125,9 +125,8 @@ public String getId() { public static MediaFingerprint loadJSON(String json, APIContext context, String header) { MediaFingerprint mediaFingerprint = getGson().fromJson(json, MediaFingerprint.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(mediaFingerprint.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(mediaFingerprint.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList mediaFingerprints = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MediaTitle.java b/src/main/java/com/facebook/ads/sdk/MediaTitle.java index 29db266f..20eeaea1 100644 --- a/src/main/java/com/facebook/ads/sdk/MediaTitle.java +++ b/src/main/java/com/facebook/ads/sdk/MediaTitle.java @@ -153,9 +153,8 @@ public String getId() { public static MediaTitle loadJSON(String json, APIContext context, String header) { MediaTitle mediaTitle = getGson().fromJson(json, MediaTitle.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(mediaTitle.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(mediaTitle.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -175,10 +174,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList mediaTitles = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MerchantCompliance.java b/src/main/java/com/facebook/ads/sdk/MerchantCompliance.java index 998267fc..0b5c6127 100644 --- a/src/main/java/com/facebook/ads/sdk/MerchantCompliance.java +++ b/src/main/java/com/facebook/ads/sdk/MerchantCompliance.java @@ -62,9 +62,8 @@ public String getId() { public static MerchantCompliance loadJSON(String json, APIContext context, String header) { MerchantCompliance merchantCompliance = getGson().fromJson(json, MerchantCompliance.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(merchantCompliance.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(merchantCompliance.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList merchantCompliances = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MerchantReport.java b/src/main/java/com/facebook/ads/sdk/MerchantReport.java index 86e30fc0..5e8dabcc 100644 --- a/src/main/java/com/facebook/ads/sdk/MerchantReport.java +++ b/src/main/java/com/facebook/ads/sdk/MerchantReport.java @@ -82,9 +82,8 @@ public String getId() { public static MerchantReport loadJSON(String json, APIContext context, String header) { MerchantReport merchantReport = getGson().fromJson(json, MerchantReport.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(merchantReport.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(merchantReport.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -104,10 +103,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList merchantReports = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MessageDeliveryEstimate.java b/src/main/java/com/facebook/ads/sdk/MessageDeliveryEstimate.java index 80b479fe..9a4febd9 100644 --- a/src/main/java/com/facebook/ads/sdk/MessageDeliveryEstimate.java +++ b/src/main/java/com/facebook/ads/sdk/MessageDeliveryEstimate.java @@ -70,9 +70,8 @@ public String getId() { public static MessageDeliveryEstimate loadJSON(String json, APIContext context, String header) { MessageDeliveryEstimate messageDeliveryEstimate = getGson().fromJson(json, MessageDeliveryEstimate.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(messageDeliveryEstimate.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(messageDeliveryEstimate.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse(String json, AP APINodeList messageDeliveryEstimates = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MessagingAppsInfo.java b/src/main/java/com/facebook/ads/sdk/MessagingAppsInfo.java index bb45611c..b4764154 100644 --- a/src/main/java/com/facebook/ads/sdk/MessagingAppsInfo.java +++ b/src/main/java/com/facebook/ads/sdk/MessagingAppsInfo.java @@ -62,9 +62,8 @@ public String getId() { public static MessagingAppsInfo loadJSON(String json, APIContext context, String header) { MessagingAppsInfo messagingAppsInfo = getGson().fromJson(json, MessagingAppsInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(messagingAppsInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(messagingAppsInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList messagingAppsInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MessagingFeatureReview.java b/src/main/java/com/facebook/ads/sdk/MessagingFeatureReview.java index b138a6d4..f34d55cd 100644 --- a/src/main/java/com/facebook/ads/sdk/MessagingFeatureReview.java +++ b/src/main/java/com/facebook/ads/sdk/MessagingFeatureReview.java @@ -56,9 +56,8 @@ public String getId() { public static MessagingFeatureReview loadJSON(String json, APIContext context, String header) { MessagingFeatureReview messagingFeatureReview = getGson().fromJson(json, MessagingFeatureReview.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(messagingFeatureReview.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(messagingFeatureReview.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, API APINodeList messagingFeatureReviews = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MessagingFeatureStatus.java b/src/main/java/com/facebook/ads/sdk/MessagingFeatureStatus.java index 3bba5e90..3d2ebde0 100644 --- a/src/main/java/com/facebook/ads/sdk/MessagingFeatureStatus.java +++ b/src/main/java/com/facebook/ads/sdk/MessagingFeatureStatus.java @@ -58,9 +58,8 @@ public String getId() { public static MessagingFeatureStatus loadJSON(String json, APIContext context, String header) { MessagingFeatureStatus messagingFeatureStatus = getGson().fromJson(json, MessagingFeatureStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(messagingFeatureStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(messagingFeatureStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, API APINodeList messagingFeatureStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MessengerAdsPartialAutomatedStepList.java b/src/main/java/com/facebook/ads/sdk/MessengerAdsPartialAutomatedStepList.java index 20542cca..875ece32 100644 --- a/src/main/java/com/facebook/ads/sdk/MessengerAdsPartialAutomatedStepList.java +++ b/src/main/java/com/facebook/ads/sdk/MessengerAdsPartialAutomatedStepList.java @@ -125,9 +125,8 @@ public String getId() { public static MessengerAdsPartialAutomatedStepList loadJSON(String json, APIContext context, String header) { MessengerAdsPartialAutomatedStepList messengerAdsPartialAutomatedStepList = getGson().fromJson(json, MessengerAdsPartialAutomatedStepList.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(messengerAdsPartialAutomatedStepList.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(messengerAdsPartialAutomatedStepList.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(St APINodeList messengerAdsPartialAutomatedStepLists = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MessengerBusinessTemplate.java b/src/main/java/com/facebook/ads/sdk/MessengerBusinessTemplate.java index 19e0a489..2facf3be 100644 --- a/src/main/java/com/facebook/ads/sdk/MessengerBusinessTemplate.java +++ b/src/main/java/com/facebook/ads/sdk/MessengerBusinessTemplate.java @@ -133,9 +133,8 @@ public String getId() { public static MessengerBusinessTemplate loadJSON(String json, APIContext context, String header) { MessengerBusinessTemplate messengerBusinessTemplate = getGson().fromJson(json, MessengerBusinessTemplate.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(messengerBusinessTemplate.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(messengerBusinessTemplate.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -155,10 +154,9 @@ public static APINodeList parseResponse(String json, APINodeList messengerBusinessTemplates = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MessengerCallSettings.java b/src/main/java/com/facebook/ads/sdk/MessengerCallSettings.java index 709d4585..efd29fa1 100644 --- a/src/main/java/com/facebook/ads/sdk/MessengerCallSettings.java +++ b/src/main/java/com/facebook/ads/sdk/MessengerCallSettings.java @@ -54,9 +54,8 @@ public String getId() { public static MessengerCallSettings loadJSON(String json, APIContext context, String header) { MessengerCallSettings messengerCallSettings = getGson().fromJson(json, MessengerCallSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(messengerCallSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(messengerCallSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList messengerCallSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MessengerDestinationPageWelcomeMessage.java b/src/main/java/com/facebook/ads/sdk/MessengerDestinationPageWelcomeMessage.java index ae42bc2f..9b2df98e 100644 --- a/src/main/java/com/facebook/ads/sdk/MessengerDestinationPageWelcomeMessage.java +++ b/src/main/java/com/facebook/ads/sdk/MessengerDestinationPageWelcomeMessage.java @@ -64,9 +64,8 @@ public String getId() { public static MessengerDestinationPageWelcomeMessage loadJSON(String json, APIContext context, String header) { MessengerDestinationPageWelcomeMessage messengerDestinationPageWelcomeMessage = getGson().fromJson(json, MessengerDestinationPageWelcomeMessage.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(messengerDestinationPageWelcomeMessage.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(messengerDestinationPageWelcomeMessage.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse( APINodeList messengerDestinationPageWelcomeMessages = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MessengerProfile.java b/src/main/java/com/facebook/ads/sdk/MessengerProfile.java index 511fd90b..0d0c83ec 100644 --- a/src/main/java/com/facebook/ads/sdk/MessengerProfile.java +++ b/src/main/java/com/facebook/ads/sdk/MessengerProfile.java @@ -72,9 +72,8 @@ public String getId() { public static MessengerProfile loadJSON(String json, APIContext context, String header) { MessengerProfile messengerProfile = getGson().fromJson(json, MessengerProfile.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(messengerProfile.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(messengerProfile.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -94,10 +93,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList messengerProfiles = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MinimumBudget.java b/src/main/java/com/facebook/ads/sdk/MinimumBudget.java index f61a5c5a..88b61a15 100644 --- a/src/main/java/com/facebook/ads/sdk/MinimumBudget.java +++ b/src/main/java/com/facebook/ads/sdk/MinimumBudget.java @@ -62,9 +62,8 @@ public String getId() { public static MinimumBudget loadJSON(String json, APIContext context, String header) { MinimumBudget minimumBudget = getGson().fromJson(json, MinimumBudget.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(minimumBudget.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(minimumBudget.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList minimumBudgets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MusicVideoCopyright.java b/src/main/java/com/facebook/ads/sdk/MusicVideoCopyright.java index 4407a26e..db83a49b 100644 --- a/src/main/java/com/facebook/ads/sdk/MusicVideoCopyright.java +++ b/src/main/java/com/facebook/ads/sdk/MusicVideoCopyright.java @@ -139,9 +139,8 @@ public String getId() { public static MusicVideoCopyright loadJSON(String json, APIContext context, String header) { MusicVideoCopyright musicVideoCopyright = getGson().fromJson(json, MusicVideoCopyright.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(musicVideoCopyright.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(musicVideoCopyright.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -161,10 +160,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList musicVideoCopyrights = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/MusicWorkCopyright.java b/src/main/java/com/facebook/ads/sdk/MusicWorkCopyright.java index 822a90ca..fe9bbdc6 100644 --- a/src/main/java/com/facebook/ads/sdk/MusicWorkCopyright.java +++ b/src/main/java/com/facebook/ads/sdk/MusicWorkCopyright.java @@ -133,9 +133,8 @@ public String getId() { public static MusicWorkCopyright loadJSON(String json, APIContext context, String header) { MusicWorkCopyright musicWorkCopyright = getGson().fromJson(json, MusicWorkCopyright.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(musicWorkCopyright.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(musicWorkCopyright.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -155,10 +154,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList musicWorkCopyrights = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/NegativeKeywordList.java b/src/main/java/com/facebook/ads/sdk/NegativeKeywordList.java index bcecf2ef..b3937c5c 100644 --- a/src/main/java/com/facebook/ads/sdk/NegativeKeywordList.java +++ b/src/main/java/com/facebook/ads/sdk/NegativeKeywordList.java @@ -135,9 +135,8 @@ public String getId() { public static NegativeKeywordList loadJSON(String json, APIContext context, String header) { NegativeKeywordList negativeKeywordList = getGson().fromJson(json, NegativeKeywordList.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(negativeKeywordList.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(negativeKeywordList.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -157,10 +156,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList negativeKeywordLists = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/NullNode.java b/src/main/java/com/facebook/ads/sdk/NullNode.java index f4e34149..e27e4352 100644 --- a/src/main/java/com/facebook/ads/sdk/NullNode.java +++ b/src/main/java/com/facebook/ads/sdk/NullNode.java @@ -52,9 +52,8 @@ public String getId() { public static NullNode loadJSON(String json, APIContext context, String header) { NullNode nullNode = getGson().fromJson(json, NullNode.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(nullNode.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(nullNode.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList nullNodes = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSet.java b/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSet.java index de6de406..06896436 100644 --- a/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSet.java +++ b/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSet.java @@ -175,9 +175,8 @@ public String getId() { public static OfflineConversionDataSet loadJSON(String json, APIContext context, String header) { OfflineConversionDataSet offlineConversionDataSet = getGson().fromJson(json, OfflineConversionDataSet.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(offlineConversionDataSet.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(offlineConversionDataSet.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -197,10 +196,9 @@ public static APINodeList parseResponse(String json, A APINodeList offlineConversionDataSets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetActivities.java b/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetActivities.java index 3014271b..f472b3fd 100644 --- a/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetActivities.java +++ b/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetActivities.java @@ -70,9 +70,8 @@ public String getId() { public static OfflineConversionDataSetActivities loadJSON(String json, APIContext context, String header) { OfflineConversionDataSetActivities offlineConversionDataSetActivities = getGson().fromJson(json, OfflineConversionDataSetActivities.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(offlineConversionDataSetActivities.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(offlineConversionDataSetActivities.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse(Stri APINodeList offlineConversionDataSetActivitiess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetOptimizationStatus.java b/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetOptimizationStatus.java index 6feb34f3..a2a7a6a5 100644 --- a/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetOptimizationStatus.java +++ b/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetOptimizationStatus.java @@ -60,9 +60,8 @@ public String getId() { public static OfflineConversionDataSetOptimizationStatus loadJSON(String json, APIContext context, String header) { OfflineConversionDataSetOptimizationStatus offlineConversionDataSetOptimizationStatus = getGson().fromJson(json, OfflineConversionDataSetOptimizationStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(offlineConversionDataSetOptimizationStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(offlineConversionDataSetOptimizationStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseRespo APINodeList offlineConversionDataSetOptimizationStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetPermissions.java b/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetPermissions.java index edcc26af..640b8ac7 100644 --- a/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetPermissions.java +++ b/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetPermissions.java @@ -60,9 +60,8 @@ public String getId() { public static OfflineConversionDataSetPermissions loadJSON(String json, APIContext context, String header) { OfflineConversionDataSetPermissions offlineConversionDataSetPermissions = getGson().fromJson(json, OfflineConversionDataSetPermissions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(offlineConversionDataSetPermissions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(offlineConversionDataSetPermissions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(Str APINodeList offlineConversionDataSetPermissionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetUpload.java b/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetUpload.java index c403da5e..bbda5fed 100644 --- a/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetUpload.java +++ b/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetUpload.java @@ -139,9 +139,8 @@ public String getId() { public static OfflineConversionDataSetUpload loadJSON(String json, APIContext context, String header) { OfflineConversionDataSetUpload offlineConversionDataSetUpload = getGson().fromJson(json, OfflineConversionDataSetUpload.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(offlineConversionDataSetUpload.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(offlineConversionDataSetUpload.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -161,10 +160,9 @@ public static APINodeList parseResponse(String j APINodeList offlineConversionDataSetUploads = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetUsage.java b/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetUsage.java index 1a210b2c..5118ee04 100644 --- a/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetUsage.java +++ b/src/main/java/com/facebook/ads/sdk/OfflineConversionDataSetUsage.java @@ -54,9 +54,8 @@ public String getId() { public static OfflineConversionDataSetUsage loadJSON(String json, APIContext context, String header) { OfflineConversionDataSetUsage offlineConversionDataSetUsage = getGson().fromJson(json, OfflineConversionDataSetUsage.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(offlineConversionDataSetUsage.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(offlineConversionDataSetUsage.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String js APINodeList offlineConversionDataSetUsages = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/OfflineProductItem.java b/src/main/java/com/facebook/ads/sdk/OfflineProductItem.java index bc720b56..a036716a 100644 --- a/src/main/java/com/facebook/ads/sdk/OfflineProductItem.java +++ b/src/main/java/com/facebook/ads/sdk/OfflineProductItem.java @@ -143,9 +143,8 @@ public String getId() { public static OfflineProductItem loadJSON(String json, APIContext context, String header) { OfflineProductItem offlineProductItem = getGson().fromJson(json, OfflineProductItem.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(offlineProductItem.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(offlineProductItem.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -165,10 +164,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList offlineProductItems = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/OfflineTermsOfService.java b/src/main/java/com/facebook/ads/sdk/OfflineTermsOfService.java index 274ed317..ceac203b 100644 --- a/src/main/java/com/facebook/ads/sdk/OfflineTermsOfService.java +++ b/src/main/java/com/facebook/ads/sdk/OfflineTermsOfService.java @@ -117,9 +117,8 @@ public String getId() { public static OfflineTermsOfService loadJSON(String json, APIContext context, String header) { OfflineTermsOfService offlineTermsOfService = getGson().fromJson(json, OfflineTermsOfService.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(offlineTermsOfService.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(offlineTermsOfService.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList offlineTermsOfServices = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/OffsitePixel.java b/src/main/java/com/facebook/ads/sdk/OffsitePixel.java index 71717a2f..c7c48a33 100644 --- a/src/main/java/com/facebook/ads/sdk/OffsitePixel.java +++ b/src/main/java/com/facebook/ads/sdk/OffsitePixel.java @@ -123,9 +123,8 @@ public String getId() { public static OffsitePixel loadJSON(String json, APIContext context, String header) { OffsitePixel offsitePixel = getGson().fromJson(json, OffsitePixel.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(offsitePixel.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(offsitePixel.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList offsitePixels = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/OffsiteSignalContainerBusinessObject.java b/src/main/java/com/facebook/ads/sdk/OffsiteSignalContainerBusinessObject.java index dbfa5de7..a9a8147c 100644 --- a/src/main/java/com/facebook/ads/sdk/OffsiteSignalContainerBusinessObject.java +++ b/src/main/java/com/facebook/ads/sdk/OffsiteSignalContainerBusinessObject.java @@ -125,9 +125,8 @@ public String getId() { public static OffsiteSignalContainerBusinessObject loadJSON(String json, APIContext context, String header) { OffsiteSignalContainerBusinessObject offsiteSignalContainerBusinessObject = getGson().fromJson(json, OffsiteSignalContainerBusinessObject.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(offsiteSignalContainerBusinessObject.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(offsiteSignalContainerBusinessObject.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(St APINodeList offsiteSignalContainerBusinessObjects = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/OmegaCustomerTrx.java b/src/main/java/com/facebook/ads/sdk/OmegaCustomerTrx.java index 316a008c..c0526602 100644 --- a/src/main/java/com/facebook/ads/sdk/OmegaCustomerTrx.java +++ b/src/main/java/com/facebook/ads/sdk/OmegaCustomerTrx.java @@ -149,9 +149,8 @@ public String getId() { public static OmegaCustomerTrx loadJSON(String json, APIContext context, String header) { OmegaCustomerTrx omegaCustomerTrx = getGson().fromJson(json, OmegaCustomerTrx.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(omegaCustomerTrx.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(omegaCustomerTrx.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -171,10 +170,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList omegaCustomerTrxs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/OpenBridgeConfiguration.java b/src/main/java/com/facebook/ads/sdk/OpenBridgeConfiguration.java index 9bdf31b0..30a9798e 100644 --- a/src/main/java/com/facebook/ads/sdk/OpenBridgeConfiguration.java +++ b/src/main/java/com/facebook/ads/sdk/OpenBridgeConfiguration.java @@ -129,9 +129,8 @@ public String getId() { public static OpenBridgeConfiguration loadJSON(String json, APIContext context, String header) { OpenBridgeConfiguration openBridgeConfiguration = getGson().fromJson(json, OpenBridgeConfiguration.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(openBridgeConfiguration.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(openBridgeConfiguration.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse(String json, AP APINodeList openBridgeConfigurations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/OpenGraphContext.java b/src/main/java/com/facebook/ads/sdk/OpenGraphContext.java index cab16a55..d32009f3 100644 --- a/src/main/java/com/facebook/ads/sdk/OpenGraphContext.java +++ b/src/main/java/com/facebook/ads/sdk/OpenGraphContext.java @@ -113,9 +113,8 @@ public String getId() { public static OpenGraphContext loadJSON(String json, APIContext context, String header) { OpenGraphContext openGraphContext = getGson().fromJson(json, OpenGraphContext.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(openGraphContext.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(openGraphContext.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -135,10 +134,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList openGraphContexts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/OrderIDAttributions.java b/src/main/java/com/facebook/ads/sdk/OrderIDAttributions.java index 60d943a8..9b536aca 100644 --- a/src/main/java/com/facebook/ads/sdk/OrderIDAttributions.java +++ b/src/main/java/com/facebook/ads/sdk/OrderIDAttributions.java @@ -70,9 +70,8 @@ public String getId() { public static OrderIDAttributions loadJSON(String json, APIContext context, String header) { OrderIDAttributions orderIDAttributions = getGson().fromJson(json, OrderIDAttributions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(orderIDAttributions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(orderIDAttributions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList orderIDAttributionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Organization.java b/src/main/java/com/facebook/ads/sdk/Organization.java index 383dfbe4..16628952 100644 --- a/src/main/java/com/facebook/ads/sdk/Organization.java +++ b/src/main/java/com/facebook/ads/sdk/Organization.java @@ -121,9 +121,8 @@ public String getId() { public static Organization loadJSON(String json, APIContext context, String header) { Organization organization = getGson().fromJson(json, Organization.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(organization.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(organization.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList organizations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/OutcomePredictionPoint.java b/src/main/java/com/facebook/ads/sdk/OutcomePredictionPoint.java index c1dcef0b..aa37ce70 100644 --- a/src/main/java/com/facebook/ads/sdk/OutcomePredictionPoint.java +++ b/src/main/java/com/facebook/ads/sdk/OutcomePredictionPoint.java @@ -60,9 +60,8 @@ public String getId() { public static OutcomePredictionPoint loadJSON(String json, APIContext context, String header) { OutcomePredictionPoint outcomePredictionPoint = getGson().fromJson(json, OutcomePredictionPoint.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(outcomePredictionPoint.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(outcomePredictionPoint.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, API APINodeList outcomePredictionPoints = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/OverrideDetails.java b/src/main/java/com/facebook/ads/sdk/OverrideDetails.java index 878f2e1c..c8392d1d 100644 --- a/src/main/java/com/facebook/ads/sdk/OverrideDetails.java +++ b/src/main/java/com/facebook/ads/sdk/OverrideDetails.java @@ -58,9 +58,8 @@ public String getId() { public static OverrideDetails loadJSON(String json, APIContext context, String header) { OverrideDetails overrideDetails = getGson().fromJson(json, OverrideDetails.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(overrideDetails.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(overrideDetails.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList overrideDetailss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/OwnedDomain.java b/src/main/java/com/facebook/ads/sdk/OwnedDomain.java index af811688..cf182ece 100644 --- a/src/main/java/com/facebook/ads/sdk/OwnedDomain.java +++ b/src/main/java/com/facebook/ads/sdk/OwnedDomain.java @@ -121,9 +121,8 @@ public String getId() { public static OwnedDomain loadJSON(String json, APIContext context, String header) { OwnedDomain ownedDomain = getGson().fromJson(json, OwnedDomain.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(ownedDomain.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(ownedDomain.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList ownedDomains = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/P2MInvoicePayments.java b/src/main/java/com/facebook/ads/sdk/P2MInvoicePayments.java index b528cde5..a07f435e 100644 --- a/src/main/java/com/facebook/ads/sdk/P2MInvoicePayments.java +++ b/src/main/java/com/facebook/ads/sdk/P2MInvoicePayments.java @@ -56,9 +56,8 @@ public String getId() { public static P2MInvoicePayments loadJSON(String json, APIContext context, String header) { P2MInvoicePayments p2mInvoicePayments = getGson().fromJson(json, P2MInvoicePayments.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(p2mInvoicePayments.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(p2mInvoicePayments.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList p2mInvoicePaymentss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Page.java b/src/main/java/com/facebook/ads/sdk/Page.java index f19db64c..89c19605 100644 --- a/src/main/java/com/facebook/ads/sdk/Page.java +++ b/src/main/java/com/facebook/ads/sdk/Page.java @@ -413,9 +413,8 @@ public String getId() { public static Page loadJSON(String json, APIContext context, String header) { Page page = getGson().fromJson(json, Page.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(page.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(page.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -435,10 +434,9 @@ public static APINodeList parseResponse(String json, APIContext context, A APINodeList pages = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageAboutStoryComposedBlock.java b/src/main/java/com/facebook/ads/sdk/PageAboutStoryComposedBlock.java index 572b0088..6fafb01c 100644 --- a/src/main/java/com/facebook/ads/sdk/PageAboutStoryComposedBlock.java +++ b/src/main/java/com/facebook/ads/sdk/PageAboutStoryComposedBlock.java @@ -62,9 +62,8 @@ public String getId() { public static PageAboutStoryComposedBlock loadJSON(String json, APIContext context, String header) { PageAboutStoryComposedBlock pageAboutStoryComposedBlock = getGson().fromJson(json, PageAboutStoryComposedBlock.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageAboutStoryComposedBlock.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageAboutStoryComposedBlock.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json APINodeList pageAboutStoryComposedBlocks = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageAboutStoryComposedBlockEntityRanges.java b/src/main/java/com/facebook/ads/sdk/PageAboutStoryComposedBlockEntityRanges.java index 80067fec..d57527f6 100644 --- a/src/main/java/com/facebook/ads/sdk/PageAboutStoryComposedBlockEntityRanges.java +++ b/src/main/java/com/facebook/ads/sdk/PageAboutStoryComposedBlockEntityRanges.java @@ -58,9 +58,8 @@ public String getId() { public static PageAboutStoryComposedBlockEntityRanges loadJSON(String json, APIContext context, String header) { PageAboutStoryComposedBlockEntityRanges pageAboutStoryComposedBlockEntityRanges = getGson().fromJson(json, PageAboutStoryComposedBlockEntityRanges.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageAboutStoryComposedBlockEntityRanges.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageAboutStoryComposedBlockEntityRanges.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse APINodeList pageAboutStoryComposedBlockEntityRangess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageAboutStoryComposedBlockInlineStyle.java b/src/main/java/com/facebook/ads/sdk/PageAboutStoryComposedBlockInlineStyle.java index db9dfca1..aa122395 100644 --- a/src/main/java/com/facebook/ads/sdk/PageAboutStoryComposedBlockInlineStyle.java +++ b/src/main/java/com/facebook/ads/sdk/PageAboutStoryComposedBlockInlineStyle.java @@ -58,9 +58,8 @@ public String getId() { public static PageAboutStoryComposedBlockInlineStyle loadJSON(String json, APIContext context, String header) { PageAboutStoryComposedBlockInlineStyle pageAboutStoryComposedBlockInlineStyle = getGson().fromJson(json, PageAboutStoryComposedBlockInlineStyle.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageAboutStoryComposedBlockInlineStyle.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageAboutStoryComposedBlockInlineStyle.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse( APINodeList pageAboutStoryComposedBlockInlineStyles = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageAppWithLeadsAccess.java b/src/main/java/com/facebook/ads/sdk/PageAppWithLeadsAccess.java index 52ab8217..e84f6d7b 100644 --- a/src/main/java/com/facebook/ads/sdk/PageAppWithLeadsAccess.java +++ b/src/main/java/com/facebook/ads/sdk/PageAppWithLeadsAccess.java @@ -56,9 +56,8 @@ public String getId() { public static PageAppWithLeadsAccess loadJSON(String json, APIContext context, String header) { PageAppWithLeadsAccess pageAppWithLeadsAccess = getGson().fromJson(json, PageAppWithLeadsAccess.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageAppWithLeadsAccess.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageAppWithLeadsAccess.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, API APINodeList pageAppWithLeadsAccesss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageBroadcast.java b/src/main/java/com/facebook/ads/sdk/PageBroadcast.java index ec9fc712..d8ceb80d 100644 --- a/src/main/java/com/facebook/ads/sdk/PageBroadcast.java +++ b/src/main/java/com/facebook/ads/sdk/PageBroadcast.java @@ -117,9 +117,8 @@ public String getId() { public static PageBroadcast loadJSON(String json, APIContext context, String header) { PageBroadcast pageBroadcast = getGson().fromJson(json, PageBroadcast.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageBroadcast.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageBroadcast.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList pageBroadcasts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageCTSTopic.java b/src/main/java/com/facebook/ads/sdk/PageCTSTopic.java index c7a05483..5f707185 100644 --- a/src/main/java/com/facebook/ads/sdk/PageCTSTopic.java +++ b/src/main/java/com/facebook/ads/sdk/PageCTSTopic.java @@ -64,9 +64,8 @@ public String getId() { public static PageCTSTopic loadJSON(String json, APIContext context, String header) { PageCTSTopic pageCTSTopic = getGson().fromJson(json, PageCTSTopic.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageCTSTopic.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageCTSTopic.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList pageCTSTopics = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageCTXBudgetSimilarAdvertiserBudgetRecommendation.java b/src/main/java/com/facebook/ads/sdk/PageCTXBudgetSimilarAdvertiserBudgetRecommendation.java index ba17e492..a7d89412 100644 --- a/src/main/java/com/facebook/ads/sdk/PageCTXBudgetSimilarAdvertiserBudgetRecommendation.java +++ b/src/main/java/com/facebook/ads/sdk/PageCTXBudgetSimilarAdvertiserBudgetRecommendation.java @@ -56,9 +56,8 @@ public String getId() { public static PageCTXBudgetSimilarAdvertiserBudgetRecommendation loadJSON(String json, APIContext context, String header) { PageCTXBudgetSimilarAdvertiserBudgetRecommendation pageCTXBudgetSimilarAdvertiserBudgetRecommendation = getGson().fromJson(json, PageCTXBudgetSimilarAdvertiserBudgetRecommendation.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageCTXBudgetSimilarAdvertiserBudgetRecommendation.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageCTXBudgetSimilarAdvertiserBudgetRecommendation.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList pa APINodeList pageCTXBudgetSimilarAdvertiserBudgetRecommendations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageCTXDefaultGreetingText.java b/src/main/java/com/facebook/ads/sdk/PageCTXDefaultGreetingText.java index be50eb04..190f2bb7 100644 --- a/src/main/java/com/facebook/ads/sdk/PageCTXDefaultGreetingText.java +++ b/src/main/java/com/facebook/ads/sdk/PageCTXDefaultGreetingText.java @@ -58,9 +58,8 @@ public String getId() { public static PageCTXDefaultGreetingText loadJSON(String json, APIContext context, String header) { PageCTXDefaultGreetingText pageCTXDefaultGreetingText = getGson().fromJson(json, PageCTXDefaultGreetingText.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageCTXDefaultGreetingText.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageCTXDefaultGreetingText.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APINodeList pageCTXDefaultGreetingTexts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageCTXMessagingFeatureLimit.java b/src/main/java/com/facebook/ads/sdk/PageCTXMessagingFeatureLimit.java index f52a5680..5d15bdd1 100644 --- a/src/main/java/com/facebook/ads/sdk/PageCTXMessagingFeatureLimit.java +++ b/src/main/java/com/facebook/ads/sdk/PageCTXMessagingFeatureLimit.java @@ -58,9 +58,8 @@ public String getId() { public static PageCTXMessagingFeatureLimit loadJSON(String json, APIContext context, String header) { PageCTXMessagingFeatureLimit pageCTXMessagingFeatureLimit = getGson().fromJson(json, PageCTXMessagingFeatureLimit.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageCTXMessagingFeatureLimit.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageCTXMessagingFeatureLimit.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String jso APINodeList pageCTXMessagingFeatureLimits = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageCallToAction.java b/src/main/java/com/facebook/ads/sdk/PageCallToAction.java index a8e8a7e4..fd5999c6 100644 --- a/src/main/java/com/facebook/ads/sdk/PageCallToAction.java +++ b/src/main/java/com/facebook/ads/sdk/PageCallToAction.java @@ -149,9 +149,8 @@ public String getId() { public static PageCallToAction loadJSON(String json, APIContext context, String header) { PageCallToAction pageCallToAction = getGson().fromJson(json, PageCallToAction.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageCallToAction.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageCallToAction.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -171,10 +170,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList pageCallToActions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageCategory.java b/src/main/java/com/facebook/ads/sdk/PageCategory.java index b61ff929..7ca9e831 100644 --- a/src/main/java/com/facebook/ads/sdk/PageCategory.java +++ b/src/main/java/com/facebook/ads/sdk/PageCategory.java @@ -60,9 +60,8 @@ public String getId() { public static PageCategory loadJSON(String json, APIContext context, String header) { PageCategory pageCategory = getGson().fromJson(json, PageCategory.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageCategory.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageCategory.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList pageCategorys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageChangeProposal.java b/src/main/java/com/facebook/ads/sdk/PageChangeProposal.java index 1c05308a..2a723f0d 100644 --- a/src/main/java/com/facebook/ads/sdk/PageChangeProposal.java +++ b/src/main/java/com/facebook/ads/sdk/PageChangeProposal.java @@ -64,9 +64,8 @@ public String getId() { public static PageChangeProposal loadJSON(String json, APIContext context, String header) { PageChangeProposal pageChangeProposal = getGson().fromJson(json, PageChangeProposal.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageChangeProposal.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageChangeProposal.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList pageChangeProposals = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageCrmsWithLeadsAccess.java b/src/main/java/com/facebook/ads/sdk/PageCrmsWithLeadsAccess.java index b1780773..d4789a8f 100644 --- a/src/main/java/com/facebook/ads/sdk/PageCrmsWithLeadsAccess.java +++ b/src/main/java/com/facebook/ads/sdk/PageCrmsWithLeadsAccess.java @@ -60,9 +60,8 @@ public String getId() { public static PageCrmsWithLeadsAccess loadJSON(String json, APIContext context, String header) { PageCrmsWithLeadsAccess pageCrmsWithLeadsAccess = getGson().fromJson(json, PageCrmsWithLeadsAccess.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageCrmsWithLeadsAccess.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageCrmsWithLeadsAccess.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, AP APINodeList pageCrmsWithLeadsAccesss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageDirectIntegrationCrmWithLeadsAccess.java b/src/main/java/com/facebook/ads/sdk/PageDirectIntegrationCrmWithLeadsAccess.java index 6bf9b4e7..5b0f5467 100644 --- a/src/main/java/com/facebook/ads/sdk/PageDirectIntegrationCrmWithLeadsAccess.java +++ b/src/main/java/com/facebook/ads/sdk/PageDirectIntegrationCrmWithLeadsAccess.java @@ -58,9 +58,8 @@ public String getId() { public static PageDirectIntegrationCrmWithLeadsAccess loadJSON(String json, APIContext context, String header) { PageDirectIntegrationCrmWithLeadsAccess pageDirectIntegrationCrmWithLeadsAccess = getGson().fromJson(json, PageDirectIntegrationCrmWithLeadsAccess.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageDirectIntegrationCrmWithLeadsAccess.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageDirectIntegrationCrmWithLeadsAccess.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse APINodeList pageDirectIntegrationCrmWithLeadsAccesss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageGameBotQuotaInformation.java b/src/main/java/com/facebook/ads/sdk/PageGameBotQuotaInformation.java index 5225466d..1f8bcba3 100644 --- a/src/main/java/com/facebook/ads/sdk/PageGameBotQuotaInformation.java +++ b/src/main/java/com/facebook/ads/sdk/PageGameBotQuotaInformation.java @@ -56,9 +56,8 @@ public String getId() { public static PageGameBotQuotaInformation loadJSON(String json, APIContext context, String header) { PageGameBotQuotaInformation pageGameBotQuotaInformation = getGson().fromJson(json, PageGameBotQuotaInformation.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageGameBotQuotaInformation.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageGameBotQuotaInformation.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json APINodeList pageGameBotQuotaInformations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageGetStartedNullstate.java b/src/main/java/com/facebook/ads/sdk/PageGetStartedNullstate.java index 0a4b42fd..570d4e13 100644 --- a/src/main/java/com/facebook/ads/sdk/PageGetStartedNullstate.java +++ b/src/main/java/com/facebook/ads/sdk/PageGetStartedNullstate.java @@ -58,9 +58,8 @@ public String getId() { public static PageGetStartedNullstate loadJSON(String json, APIContext context, String header) { PageGetStartedNullstate pageGetStartedNullstate = getGson().fromJson(json, PageGetStartedNullstate.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageGetStartedNullstate.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageGetStartedNullstate.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, AP APINodeList pageGetStartedNullstates = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageInsightsAsyncExportRun.java b/src/main/java/com/facebook/ads/sdk/PageInsightsAsyncExportRun.java index 4ff98d08..ea78cc61 100644 --- a/src/main/java/com/facebook/ads/sdk/PageInsightsAsyncExportRun.java +++ b/src/main/java/com/facebook/ads/sdk/PageInsightsAsyncExportRun.java @@ -129,9 +129,8 @@ public String getId() { public static PageInsightsAsyncExportRun loadJSON(String json, APIContext context, String header) { PageInsightsAsyncExportRun pageInsightsAsyncExportRun = getGson().fromJson(json, PageInsightsAsyncExportRun.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageInsightsAsyncExportRun.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageInsightsAsyncExportRun.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse(String json, APINodeList pageInsightsAsyncExportRuns = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageLeadsAccessConfig.java b/src/main/java/com/facebook/ads/sdk/PageLeadsAccessConfig.java index 9292b812..1ad0aa1f 100644 --- a/src/main/java/com/facebook/ads/sdk/PageLeadsAccessConfig.java +++ b/src/main/java/com/facebook/ads/sdk/PageLeadsAccessConfig.java @@ -115,9 +115,8 @@ public String getId() { public static PageLeadsAccessConfig loadJSON(String json, APIContext context, String header) { PageLeadsAccessConfig pageLeadsAccessConfig = getGson().fromJson(json, PageLeadsAccessConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageLeadsAccessConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageLeadsAccessConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList pageLeadsAccessConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageLocationsBreakdown.java b/src/main/java/com/facebook/ads/sdk/PageLocationsBreakdown.java index ee550c52..ac9e130f 100644 --- a/src/main/java/com/facebook/ads/sdk/PageLocationsBreakdown.java +++ b/src/main/java/com/facebook/ads/sdk/PageLocationsBreakdown.java @@ -70,9 +70,8 @@ public String getId() { public static PageLocationsBreakdown loadJSON(String json, APIContext context, String header) { PageLocationsBreakdown pageLocationsBreakdown = getGson().fromJson(json, PageLocationsBreakdown.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageLocationsBreakdown.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageLocationsBreakdown.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse(String json, API APINodeList pageLocationsBreakdowns = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageMessageResponsivenessMetrics.java b/src/main/java/com/facebook/ads/sdk/PageMessageResponsivenessMetrics.java index 80ea1da6..8d88c9e7 100644 --- a/src/main/java/com/facebook/ads/sdk/PageMessageResponsivenessMetrics.java +++ b/src/main/java/com/facebook/ads/sdk/PageMessageResponsivenessMetrics.java @@ -58,9 +58,8 @@ public String getId() { public static PageMessageResponsivenessMetrics loadJSON(String json, APIContext context, String header) { PageMessageResponsivenessMetrics pageMessageResponsivenessMetrics = getGson().fromJson(json, PageMessageResponsivenessMetrics.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageMessageResponsivenessMetrics.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageMessageResponsivenessMetrics.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String APINodeList pageMessageResponsivenessMetricss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageParking.java b/src/main/java/com/facebook/ads/sdk/PageParking.java index e88086f6..9e5afef9 100644 --- a/src/main/java/com/facebook/ads/sdk/PageParking.java +++ b/src/main/java/com/facebook/ads/sdk/PageParking.java @@ -58,9 +58,8 @@ public String getId() { public static PageParking loadJSON(String json, APIContext context, String header) { PageParking pageParking = getGson().fromJson(json, PageParking.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageParking.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageParking.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList pageParkings = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PagePartnerWithLeadsAccess.java b/src/main/java/com/facebook/ads/sdk/PagePartnerWithLeadsAccess.java index 1e834640..8a432dde 100644 --- a/src/main/java/com/facebook/ads/sdk/PagePartnerWithLeadsAccess.java +++ b/src/main/java/com/facebook/ads/sdk/PagePartnerWithLeadsAccess.java @@ -58,9 +58,8 @@ public String getId() { public static PagePartnerWithLeadsAccess loadJSON(String json, APIContext context, String header) { PagePartnerWithLeadsAccess pagePartnerWithLeadsAccess = getGson().fromJson(json, PagePartnerWithLeadsAccess.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pagePartnerWithLeadsAccess.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pagePartnerWithLeadsAccess.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APINodeList pagePartnerWithLeadsAccesss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PagePaymentOptions.java b/src/main/java/com/facebook/ads/sdk/PagePaymentOptions.java index d1aba3c3..e5208227 100644 --- a/src/main/java/com/facebook/ads/sdk/PagePaymentOptions.java +++ b/src/main/java/com/facebook/ads/sdk/PagePaymentOptions.java @@ -62,9 +62,8 @@ public String getId() { public static PagePaymentOptions loadJSON(String json, APIContext context, String header) { PagePaymentOptions pagePaymentOptions = getGson().fromJson(json, PagePaymentOptions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pagePaymentOptions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pagePaymentOptions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList pagePaymentOptionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PagePost.java b/src/main/java/com/facebook/ads/sdk/PagePost.java index 2311e30f..02571b67 100644 --- a/src/main/java/com/facebook/ads/sdk/PagePost.java +++ b/src/main/java/com/facebook/ads/sdk/PagePost.java @@ -221,9 +221,8 @@ public String getId() { public static PagePost loadJSON(String json, APIContext context, String header) { PagePost pagePost = getGson().fromJson(json, PagePost.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pagePost.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pagePost.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -243,10 +242,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList pagePosts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PagePostExperiment.java b/src/main/java/com/facebook/ads/sdk/PagePostExperiment.java index 670a857c..acbdf9f8 100644 --- a/src/main/java/com/facebook/ads/sdk/PagePostExperiment.java +++ b/src/main/java/com/facebook/ads/sdk/PagePostExperiment.java @@ -143,9 +143,8 @@ public String getId() { public static PagePostExperiment loadJSON(String json, APIContext context, String header) { PagePostExperiment pagePostExperiment = getGson().fromJson(json, PagePostExperiment.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pagePostExperiment.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pagePostExperiment.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -165,10 +164,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList pagePostExperiments = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PagePublisher.java b/src/main/java/com/facebook/ads/sdk/PagePublisher.java index 791f3418..c63eb46f 100644 --- a/src/main/java/com/facebook/ads/sdk/PagePublisher.java +++ b/src/main/java/com/facebook/ads/sdk/PagePublisher.java @@ -62,9 +62,8 @@ public String getId() { public static PagePublisher loadJSON(String json, APIContext context, String header) { PagePublisher pagePublisher = getGson().fromJson(json, PagePublisher.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pagePublisher.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pagePublisher.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList pagePublishers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageRestaurantServices.java b/src/main/java/com/facebook/ads/sdk/PageRestaurantServices.java index fbe250c1..45199418 100644 --- a/src/main/java/com/facebook/ads/sdk/PageRestaurantServices.java +++ b/src/main/java/com/facebook/ads/sdk/PageRestaurantServices.java @@ -72,9 +72,8 @@ public String getId() { public static PageRestaurantServices loadJSON(String json, APIContext context, String header) { PageRestaurantServices pageRestaurantServices = getGson().fromJson(json, PageRestaurantServices.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageRestaurantServices.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageRestaurantServices.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -94,10 +93,9 @@ public static APINodeList parseResponse(String json, API APINodeList pageRestaurantServicess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageRestaurantSpecialties.java b/src/main/java/com/facebook/ads/sdk/PageRestaurantSpecialties.java index d51cec0e..99b1009b 100644 --- a/src/main/java/com/facebook/ads/sdk/PageRestaurantSpecialties.java +++ b/src/main/java/com/facebook/ads/sdk/PageRestaurantSpecialties.java @@ -62,9 +62,8 @@ public String getId() { public static PageRestaurantSpecialties loadJSON(String json, APIContext context, String header) { PageRestaurantSpecialties pageRestaurantSpecialties = getGson().fromJson(json, PageRestaurantSpecialties.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageRestaurantSpecialties.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageRestaurantSpecialties.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APINodeList pageRestaurantSpecialtiess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageSettings.java b/src/main/java/com/facebook/ads/sdk/PageSettings.java index 48645e09..9de2f889 100644 --- a/src/main/java/com/facebook/ads/sdk/PageSettings.java +++ b/src/main/java/com/facebook/ads/sdk/PageSettings.java @@ -56,9 +56,8 @@ public String getId() { public static PageSettings loadJSON(String json, APIContext context, String header) { PageSettings pageSettings = getGson().fromJson(json, PageSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList pageSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageStartInfo.java b/src/main/java/com/facebook/ads/sdk/PageStartInfo.java index 37b4d56a..c2e06659 100644 --- a/src/main/java/com/facebook/ads/sdk/PageStartInfo.java +++ b/src/main/java/com/facebook/ads/sdk/PageStartInfo.java @@ -56,9 +56,8 @@ public String getId() { public static PageStartInfo loadJSON(String json, APIContext context, String header) { PageStartInfo pageStartInfo = getGson().fromJson(json, PageStartInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageStartInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageStartInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList pageStartInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageThreadOwner.java b/src/main/java/com/facebook/ads/sdk/PageThreadOwner.java index e3f69315..49dc5d3c 100644 --- a/src/main/java/com/facebook/ads/sdk/PageThreadOwner.java +++ b/src/main/java/com/facebook/ads/sdk/PageThreadOwner.java @@ -54,9 +54,8 @@ public String getId() { public static PageThreadOwner loadJSON(String json, APIContext context, String header) { PageThreadOwner pageThreadOwner = getGson().fromJson(json, PageThreadOwner.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageThreadOwner.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageThreadOwner.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList pageThreadOwners = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageUpcomingChange.java b/src/main/java/com/facebook/ads/sdk/PageUpcomingChange.java index 58190c46..e0666abd 100644 --- a/src/main/java/com/facebook/ads/sdk/PageUpcomingChange.java +++ b/src/main/java/com/facebook/ads/sdk/PageUpcomingChange.java @@ -123,9 +123,8 @@ public String getId() { public static PageUpcomingChange loadJSON(String json, APIContext context, String header) { PageUpcomingChange pageUpcomingChange = getGson().fromJson(json, PageUpcomingChange.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageUpcomingChange.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageUpcomingChange.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList pageUpcomingChanges = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageUserMessageThreadLabel.java b/src/main/java/com/facebook/ads/sdk/PageUserMessageThreadLabel.java index 585e3147..83a5cbf2 100644 --- a/src/main/java/com/facebook/ads/sdk/PageUserMessageThreadLabel.java +++ b/src/main/java/com/facebook/ads/sdk/PageUserMessageThreadLabel.java @@ -115,9 +115,8 @@ public String getId() { public static PageUserMessageThreadLabel loadJSON(String json, APIContext context, String header) { PageUserMessageThreadLabel pageUserMessageThreadLabel = getGson().fromJson(json, PageUserMessageThreadLabel.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageUserMessageThreadLabel.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageUserMessageThreadLabel.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, APINodeList pageUserMessageThreadLabels = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageUserPermissions.java b/src/main/java/com/facebook/ads/sdk/PageUserPermissions.java index 072934c0..ac7207e7 100644 --- a/src/main/java/com/facebook/ads/sdk/PageUserPermissions.java +++ b/src/main/java/com/facebook/ads/sdk/PageUserPermissions.java @@ -72,9 +72,8 @@ public String getId() { public static PageUserPermissions loadJSON(String json, APIContext context, String header) { PageUserPermissions pageUserPermissions = getGson().fromJson(json, PageUserPermissions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageUserPermissions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageUserPermissions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -94,10 +93,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList pageUserPermissionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PageUserWithLeadsAccess.java b/src/main/java/com/facebook/ads/sdk/PageUserWithLeadsAccess.java index 8d043a58..bcdef543 100644 --- a/src/main/java/com/facebook/ads/sdk/PageUserWithLeadsAccess.java +++ b/src/main/java/com/facebook/ads/sdk/PageUserWithLeadsAccess.java @@ -60,9 +60,8 @@ public String getId() { public static PageUserWithLeadsAccess loadJSON(String json, APIContext context, String header) { PageUserWithLeadsAccess pageUserWithLeadsAccess = getGson().fromJson(json, PageUserWithLeadsAccess.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(pageUserWithLeadsAccess.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(pageUserWithLeadsAccess.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, AP APINodeList pageUserWithLeadsAccesss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ParentCatalogReport.java b/src/main/java/com/facebook/ads/sdk/ParentCatalogReport.java index b65dff89..effe7646 100644 --- a/src/main/java/com/facebook/ads/sdk/ParentCatalogReport.java +++ b/src/main/java/com/facebook/ads/sdk/ParentCatalogReport.java @@ -56,9 +56,8 @@ public String getId() { public static ParentCatalogReport loadJSON(String json, APIContext context, String header) { ParentCatalogReport parentCatalogReport = getGson().fromJson(json, ParentCatalogReport.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(parentCatalogReport.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(parentCatalogReport.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList parentCatalogReports = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PartnerAccountLinking.java b/src/main/java/com/facebook/ads/sdk/PartnerAccountLinking.java index 775f612b..45840db1 100644 --- a/src/main/java/com/facebook/ads/sdk/PartnerAccountLinking.java +++ b/src/main/java/com/facebook/ads/sdk/PartnerAccountLinking.java @@ -127,9 +127,8 @@ public String getId() { public static PartnerAccountLinking loadJSON(String json, APIContext context, String header) { PartnerAccountLinking partnerAccountLinking = getGson().fromJson(json, PartnerAccountLinking.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(partnerAccountLinking.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(partnerAccountLinking.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -149,10 +148,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList partnerAccountLinkings = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PartnerCategory.java b/src/main/java/com/facebook/ads/sdk/PartnerCategory.java index 14443469..0716fc70 100644 --- a/src/main/java/com/facebook/ads/sdk/PartnerCategory.java +++ b/src/main/java/com/facebook/ads/sdk/PartnerCategory.java @@ -74,9 +74,8 @@ public String getId() { public static PartnerCategory loadJSON(String json, APIContext context, String header) { PartnerCategory partnerCategory = getGson().fromJson(json, PartnerCategory.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(partnerCategory.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(partnerCategory.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -96,10 +95,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList partnerCategorys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PartnerIntegrationLinked.java b/src/main/java/com/facebook/ads/sdk/PartnerIntegrationLinked.java index 10501f31..0b5715b2 100644 --- a/src/main/java/com/facebook/ads/sdk/PartnerIntegrationLinked.java +++ b/src/main/java/com/facebook/ads/sdk/PartnerIntegrationLinked.java @@ -143,9 +143,8 @@ public String getId() { public static PartnerIntegrationLinked loadJSON(String json, APIContext context, String header) { PartnerIntegrationLinked partnerIntegrationLinked = getGson().fromJson(json, PartnerIntegrationLinked.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(partnerIntegrationLinked.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(partnerIntegrationLinked.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -165,10 +164,9 @@ public static APINodeList parseResponse(String json, A APINodeList partnerIntegrationLinkeds = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PartnerStudy.java b/src/main/java/com/facebook/ads/sdk/PartnerStudy.java index c9c8abca..e0c85960 100644 --- a/src/main/java/com/facebook/ads/sdk/PartnerStudy.java +++ b/src/main/java/com/facebook/ads/sdk/PartnerStudy.java @@ -147,9 +147,8 @@ public String getId() { public static PartnerStudy loadJSON(String json, APIContext context, String header) { PartnerStudy partnerStudy = getGson().fromJson(json, PartnerStudy.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(partnerStudy.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(partnerStudy.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -169,10 +168,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList partnerStudys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PartnershipAdContentSearchMedia.java b/src/main/java/com/facebook/ads/sdk/PartnershipAdContentSearchMedia.java index d9a93722..0fc64bf8 100644 --- a/src/main/java/com/facebook/ads/sdk/PartnershipAdContentSearchMedia.java +++ b/src/main/java/com/facebook/ads/sdk/PartnershipAdContentSearchMedia.java @@ -64,9 +64,8 @@ public String getId() { public static PartnershipAdContentSearchMedia loadJSON(String json, APIContext context, String header) { PartnershipAdContentSearchMedia partnershipAdContentSearchMedia = getGson().fromJson(json, PartnershipAdContentSearchMedia.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(partnershipAdContentSearchMedia.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(partnershipAdContentSearchMedia.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String APINodeList partnershipAdContentSearchMedias = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PartnershipAdsIdentity.java b/src/main/java/com/facebook/ads/sdk/PartnershipAdsIdentity.java index bd78abe1..f571c4f1 100644 --- a/src/main/java/com/facebook/ads/sdk/PartnershipAdsIdentity.java +++ b/src/main/java/com/facebook/ads/sdk/PartnershipAdsIdentity.java @@ -56,9 +56,8 @@ public String getId() { public static PartnershipAdsIdentity loadJSON(String json, APIContext context, String header) { PartnershipAdsIdentity partnershipAdsIdentity = getGson().fromJson(json, PartnershipAdsIdentity.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(partnershipAdsIdentity.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(partnershipAdsIdentity.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, API APINodeList partnershipAdsIdentitys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PaymentEnginePayment.java b/src/main/java/com/facebook/ads/sdk/PaymentEnginePayment.java index e983b855..03c44171 100644 --- a/src/main/java/com/facebook/ads/sdk/PaymentEnginePayment.java +++ b/src/main/java/com/facebook/ads/sdk/PaymentEnginePayment.java @@ -151,9 +151,8 @@ public String getId() { public static PaymentEnginePayment loadJSON(String json, APIContext context, String header) { PaymentEnginePayment paymentEnginePayment = getGson().fromJson(json, PaymentEnginePayment.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(paymentEnginePayment.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(paymentEnginePayment.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -173,10 +172,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList paymentEnginePayments = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PaymentPricepoints.java b/src/main/java/com/facebook/ads/sdk/PaymentPricepoints.java index e1ce6326..5f40d6d2 100644 --- a/src/main/java/com/facebook/ads/sdk/PaymentPricepoints.java +++ b/src/main/java/com/facebook/ads/sdk/PaymentPricepoints.java @@ -54,9 +54,8 @@ public String getId() { public static PaymentPricepoints loadJSON(String json, APIContext context, String header) { PaymentPricepoints paymentPricepoints = getGson().fromJson(json, PaymentPricepoints.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(paymentPricepoints.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(paymentPricepoints.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList paymentPricepointss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PaymentRequestDetails.java b/src/main/java/com/facebook/ads/sdk/PaymentRequestDetails.java index 78341967..a799febe 100644 --- a/src/main/java/com/facebook/ads/sdk/PaymentRequestDetails.java +++ b/src/main/java/com/facebook/ads/sdk/PaymentRequestDetails.java @@ -70,9 +70,8 @@ public String getId() { public static PaymentRequestDetails loadJSON(String json, APIContext context, String header) { PaymentRequestDetails paymentRequestDetails = getGson().fromJson(json, PaymentRequestDetails.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(paymentRequestDetails.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(paymentRequestDetails.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList paymentRequestDetailss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PaymentSubscription.java b/src/main/java/com/facebook/ads/sdk/PaymentSubscription.java index 92a7026c..6c64bd6d 100644 --- a/src/main/java/com/facebook/ads/sdk/PaymentSubscription.java +++ b/src/main/java/com/facebook/ads/sdk/PaymentSubscription.java @@ -159,9 +159,8 @@ public String getId() { public static PaymentSubscription loadJSON(String json, APIContext context, String header) { PaymentSubscription paymentSubscription = getGson().fromJson(json, PaymentSubscription.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(paymentSubscription.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(paymentSubscription.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -181,10 +180,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList paymentSubscriptions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Permission.java b/src/main/java/com/facebook/ads/sdk/Permission.java index e22bc128..c39c725a 100644 --- a/src/main/java/com/facebook/ads/sdk/Permission.java +++ b/src/main/java/com/facebook/ads/sdk/Permission.java @@ -56,9 +56,8 @@ public String getId() { public static Permission loadJSON(String json, APIContext context, String header) { Permission permission = getGson().fromJson(json, Permission.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(permission.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(permission.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList permissions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Persona.java b/src/main/java/com/facebook/ads/sdk/Persona.java index 2f5a20cd..2abaca99 100644 --- a/src/main/java/com/facebook/ads/sdk/Persona.java +++ b/src/main/java/com/facebook/ads/sdk/Persona.java @@ -117,9 +117,8 @@ public String getId() { public static Persona loadJSON(String json, APIContext context, String header) { Persona persona = getGson().fromJson(json, Persona.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(persona.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(persona.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APIContext context APINodeList personas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PersonalAdsPersona.java b/src/main/java/com/facebook/ads/sdk/PersonalAdsPersona.java index 05f78e93..fbb8db03 100644 --- a/src/main/java/com/facebook/ads/sdk/PersonalAdsPersona.java +++ b/src/main/java/com/facebook/ads/sdk/PersonalAdsPersona.java @@ -121,9 +121,8 @@ public String getId() { public static PersonalAdsPersona loadJSON(String json, APIContext context, String header) { PersonalAdsPersona personalAdsPersona = getGson().fromJson(json, PersonalAdsPersona.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(personalAdsPersona.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(personalAdsPersona.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList personalAdsPersonas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Photo.java b/src/main/java/com/facebook/ads/sdk/Photo.java index 976861c3..ea823a92 100644 --- a/src/main/java/com/facebook/ads/sdk/Photo.java +++ b/src/main/java/com/facebook/ads/sdk/Photo.java @@ -165,9 +165,8 @@ public String getId() { public static Photo loadJSON(String json, APIContext context, String header) { Photo photo = getGson().fromJson(json, Photo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(photo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(photo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -187,10 +186,9 @@ public static APINodeList parseResponse(String json, APIContext context, APINodeList photos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PhotoMetadata.java b/src/main/java/com/facebook/ads/sdk/PhotoMetadata.java index e34b5e44..eb357ea9 100644 --- a/src/main/java/com/facebook/ads/sdk/PhotoMetadata.java +++ b/src/main/java/com/facebook/ads/sdk/PhotoMetadata.java @@ -76,9 +76,8 @@ public String getId() { public static PhotoMetadata loadJSON(String json, APIContext context, String header) { PhotoMetadata photoMetadata = getGson().fromJson(json, PhotoMetadata.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(photoMetadata.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(photoMetadata.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -98,10 +97,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList photoMetadatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Place.java b/src/main/java/com/facebook/ads/sdk/Place.java index c356eb5f..7610bafd 100644 --- a/src/main/java/com/facebook/ads/sdk/Place.java +++ b/src/main/java/com/facebook/ads/sdk/Place.java @@ -119,9 +119,8 @@ public String getId() { public static Place loadJSON(String json, APIContext context, String header) { Place place = getGson().fromJson(json, Place.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(place.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(place.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, APIContext context, APINodeList places = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PlaceTag.java b/src/main/java/com/facebook/ads/sdk/PlaceTag.java index 77ecd87c..efd27ad5 100644 --- a/src/main/java/com/facebook/ads/sdk/PlaceTag.java +++ b/src/main/java/com/facebook/ads/sdk/PlaceTag.java @@ -117,9 +117,8 @@ public String getId() { public static PlaceTag loadJSON(String json, APIContext context, String header) { PlaceTag placeTag = getGson().fromJson(json, PlaceTag.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(placeTag.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(placeTag.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList placeTags = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PlaceTopic.java b/src/main/java/com/facebook/ads/sdk/PlaceTopic.java index a7e58a82..16f383a2 100644 --- a/src/main/java/com/facebook/ads/sdk/PlaceTopic.java +++ b/src/main/java/com/facebook/ads/sdk/PlaceTopic.java @@ -127,9 +127,8 @@ public String getId() { public static PlaceTopic loadJSON(String json, APIContext context, String header) { PlaceTopic placeTopic = getGson().fromJson(json, PlaceTopic.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(placeTopic.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(placeTopic.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -149,10 +148,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList placeTopics = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Placement.java b/src/main/java/com/facebook/ads/sdk/Placement.java index 212428b5..cbf18630 100644 --- a/src/main/java/com/facebook/ads/sdk/Placement.java +++ b/src/main/java/com/facebook/ads/sdk/Placement.java @@ -88,9 +88,8 @@ public String getId() { public static Placement loadJSON(String json, APIContext context, String header) { Placement placement = getGson().fromJson(json, Placement.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(placement.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(placement.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -110,10 +109,9 @@ public static APINodeList parseResponse(String json, APIContext conte APINodeList placements = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PlatformImageSource.java b/src/main/java/com/facebook/ads/sdk/PlatformImageSource.java index caf5bda3..c26e0517 100644 --- a/src/main/java/com/facebook/ads/sdk/PlatformImageSource.java +++ b/src/main/java/com/facebook/ads/sdk/PlatformImageSource.java @@ -58,9 +58,8 @@ public String getId() { public static PlatformImageSource loadJSON(String json, APIContext context, String header) { PlatformImageSource platformImageSource = getGson().fromJson(json, PlatformImageSource.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(platformImageSource.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(platformImageSource.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList platformImageSources = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PlatformSessionKey.java b/src/main/java/com/facebook/ads/sdk/PlatformSessionKey.java index 927f8e21..98c583fb 100644 --- a/src/main/java/com/facebook/ads/sdk/PlatformSessionKey.java +++ b/src/main/java/com/facebook/ads/sdk/PlatformSessionKey.java @@ -54,9 +54,8 @@ public String getId() { public static PlatformSessionKey loadJSON(String json, APIContext context, String header) { PlatformSessionKey platformSessionKey = getGson().fromJson(json, PlatformSessionKey.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(platformSessionKey.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(platformSessionKey.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList platformSessionKeys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PlayableContent.java b/src/main/java/com/facebook/ads/sdk/PlayableContent.java index 1f82dfd9..84b31a24 100644 --- a/src/main/java/com/facebook/ads/sdk/PlayableContent.java +++ b/src/main/java/com/facebook/ads/sdk/PlayableContent.java @@ -117,9 +117,8 @@ public String getId() { public static PlayableContent loadJSON(String json, APIContext context, String header) { PlayableContent playableContent = getGson().fromJson(json, PlayableContent.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(playableContent.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(playableContent.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList playableContents = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Post.java b/src/main/java/com/facebook/ads/sdk/Post.java index b8564bf1..9f075179 100644 --- a/src/main/java/com/facebook/ads/sdk/Post.java +++ b/src/main/java/com/facebook/ads/sdk/Post.java @@ -235,9 +235,8 @@ public String getId() { public static Post loadJSON(String json, APIContext context, String header) { Post post = getGson().fromJson(json, Post.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(post.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(post.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -257,10 +256,9 @@ public static APINodeList parseResponse(String json, APIContext context, A APINodeList posts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PreapprovalReview.java b/src/main/java/com/facebook/ads/sdk/PreapprovalReview.java index 10f7493f..cced70fd 100644 --- a/src/main/java/com/facebook/ads/sdk/PreapprovalReview.java +++ b/src/main/java/com/facebook/ads/sdk/PreapprovalReview.java @@ -62,9 +62,8 @@ public String getId() { public static PreapprovalReview loadJSON(String json, APIContext context, String header) { PreapprovalReview preapprovalReview = getGson().fromJson(json, PreapprovalReview.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(preapprovalReview.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(preapprovalReview.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList preapprovalReviews = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PremiumMusicVideo.java b/src/main/java/com/facebook/ads/sdk/PremiumMusicVideo.java index 784846e5..521087d1 100644 --- a/src/main/java/com/facebook/ads/sdk/PremiumMusicVideo.java +++ b/src/main/java/com/facebook/ads/sdk/PremiumMusicVideo.java @@ -68,9 +68,8 @@ public String getId() { public static PremiumMusicVideo loadJSON(String json, APIContext context, String header) { PremiumMusicVideo premiumMusicVideo = getGson().fromJson(json, PremiumMusicVideo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(premiumMusicVideo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(premiumMusicVideo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList premiumMusicVideos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Privacy.java b/src/main/java/com/facebook/ads/sdk/Privacy.java index 2543302b..4abc6499 100644 --- a/src/main/java/com/facebook/ads/sdk/Privacy.java +++ b/src/main/java/com/facebook/ads/sdk/Privacy.java @@ -64,9 +64,8 @@ public String getId() { public static Privacy loadJSON(String json, APIContext context, String header) { Privacy privacy = getGson().fromJson(json, Privacy.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(privacy.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(privacy.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APIContext context APINodeList privacys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PrivacyOption.java b/src/main/java/com/facebook/ads/sdk/PrivacyOption.java index 9016ac7a..f09143e7 100644 --- a/src/main/java/com/facebook/ads/sdk/PrivacyOption.java +++ b/src/main/java/com/facebook/ads/sdk/PrivacyOption.java @@ -64,9 +64,8 @@ public String getId() { public static PrivacyOption loadJSON(String json, APIContext context, String header) { PrivacyOption privacyOption = getGson().fromJson(json, PrivacyOption.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(privacyOption.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(privacyOption.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList privacyOptions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PrivateComputationEnvironment.java b/src/main/java/com/facebook/ads/sdk/PrivateComputationEnvironment.java index 5cbe8b42..523e6ccf 100644 --- a/src/main/java/com/facebook/ads/sdk/PrivateComputationEnvironment.java +++ b/src/main/java/com/facebook/ads/sdk/PrivateComputationEnvironment.java @@ -123,9 +123,8 @@ public String getId() { public static PrivateComputationEnvironment loadJSON(String json, APIContext context, String header) { PrivateComputationEnvironment privateComputationEnvironment = getGson().fromJson(json, PrivateComputationEnvironment.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(privateComputationEnvironment.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(privateComputationEnvironment.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String js APINodeList privateComputationEnvironments = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PrivateLiftStudyInstance.java b/src/main/java/com/facebook/ads/sdk/PrivateLiftStudyInstance.java index b00981a5..498a3213 100644 --- a/src/main/java/com/facebook/ads/sdk/PrivateLiftStudyInstance.java +++ b/src/main/java/com/facebook/ads/sdk/PrivateLiftStudyInstance.java @@ -133,9 +133,8 @@ public String getId() { public static PrivateLiftStudyInstance loadJSON(String json, APIContext context, String header) { PrivateLiftStudyInstance privateLiftStudyInstance = getGson().fromJson(json, PrivateLiftStudyInstance.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(privateLiftStudyInstance.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(privateLiftStudyInstance.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -155,10 +154,9 @@ public static APINodeList parseResponse(String json, A APINodeList privateLiftStudyInstances = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalog.java b/src/main/java/com/facebook/ads/sdk/ProductCatalog.java index 1c8f1912..ee13407a 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalog.java +++ b/src/main/java/com/facebook/ads/sdk/ProductCatalog.java @@ -149,9 +149,8 @@ public String getId() { public static ProductCatalog loadJSON(String json, APIContext context, String header) { ProductCatalog productCatalog = getGson().fromJson(json, ProductCatalog.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productCatalog.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productCatalog.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -171,10 +170,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList productCatalogs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalogCategory.java b/src/main/java/com/facebook/ads/sdk/ProductCatalogCategory.java index ba0701c9..86fea7c3 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalogCategory.java +++ b/src/main/java/com/facebook/ads/sdk/ProductCatalogCategory.java @@ -66,9 +66,8 @@ public String getId() { public static ProductCatalogCategory loadJSON(String json, APIContext context, String header) { ProductCatalogCategory productCatalogCategory = getGson().fromJson(json, ProductCatalogCategory.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productCatalogCategory.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productCatalogCategory.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, API APINodeList productCatalogCategorys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalogDataSource.java b/src/main/java/com/facebook/ads/sdk/ProductCatalogDataSource.java index 5135dd07..dee7d375 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalogDataSource.java +++ b/src/main/java/com/facebook/ads/sdk/ProductCatalogDataSource.java @@ -62,9 +62,8 @@ public String getId() { public static ProductCatalogDataSource loadJSON(String json, APIContext context, String header) { ProductCatalogDataSource productCatalogDataSource = getGson().fromJson(json, ProductCatalogDataSource.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productCatalogDataSource.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productCatalogDataSource.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, A APINodeList productCatalogDataSources = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalogDiagnosticGroup.java b/src/main/java/com/facebook/ads/sdk/ProductCatalogDiagnosticGroup.java index 14b21c41..58776943 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalogDiagnosticGroup.java +++ b/src/main/java/com/facebook/ads/sdk/ProductCatalogDiagnosticGroup.java @@ -74,9 +74,8 @@ public String getId() { public static ProductCatalogDiagnosticGroup loadJSON(String json, APIContext context, String header) { ProductCatalogDiagnosticGroup productCatalogDiagnosticGroup = getGson().fromJson(json, ProductCatalogDiagnosticGroup.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productCatalogDiagnosticGroup.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productCatalogDiagnosticGroup.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -96,10 +95,9 @@ public static APINodeList parseResponse(String js APINodeList productCatalogDiagnosticGroups = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalogFacets.java b/src/main/java/com/facebook/ads/sdk/ProductCatalogFacets.java index 5970585f..7581f1bf 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalogFacets.java +++ b/src/main/java/com/facebook/ads/sdk/ProductCatalogFacets.java @@ -56,9 +56,8 @@ public String getId() { public static ProductCatalogFacets loadJSON(String json, APIContext context, String header) { ProductCatalogFacets productCatalogFacets = getGson().fromJson(json, ProductCatalogFacets.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productCatalogFacets.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productCatalogFacets.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList productCatalogFacetss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalogHotelRoomsBatch.java b/src/main/java/com/facebook/ads/sdk/ProductCatalogHotelRoomsBatch.java index b18cb447..f42b3e12 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalogHotelRoomsBatch.java +++ b/src/main/java/com/facebook/ads/sdk/ProductCatalogHotelRoomsBatch.java @@ -60,9 +60,8 @@ public String getId() { public static ProductCatalogHotelRoomsBatch loadJSON(String json, APIContext context, String header) { ProductCatalogHotelRoomsBatch productCatalogHotelRoomsBatch = getGson().fromJson(json, ProductCatalogHotelRoomsBatch.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productCatalogHotelRoomsBatch.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productCatalogHotelRoomsBatch.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String js APINodeList productCatalogHotelRoomsBatchs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalogImageSettings.java b/src/main/java/com/facebook/ads/sdk/ProductCatalogImageSettings.java index 61882da1..ae69b325 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalogImageSettings.java +++ b/src/main/java/com/facebook/ads/sdk/ProductCatalogImageSettings.java @@ -56,9 +56,8 @@ public String getId() { public static ProductCatalogImageSettings loadJSON(String json, APIContext context, String header) { ProductCatalogImageSettings productCatalogImageSettings = getGson().fromJson(json, ProductCatalogImageSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productCatalogImageSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productCatalogImageSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json APINodeList productCatalogImageSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalogImageSettingsInternal.java b/src/main/java/com/facebook/ads/sdk/ProductCatalogImageSettingsInternal.java index a6a1d0ec..410c12dd 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalogImageSettingsInternal.java +++ b/src/main/java/com/facebook/ads/sdk/ProductCatalogImageSettingsInternal.java @@ -58,9 +58,8 @@ public String getId() { public static ProductCatalogImageSettingsInternal loadJSON(String json, APIContext context, String header) { ProductCatalogImageSettingsInternal productCatalogImageSettingsInternal = getGson().fromJson(json, ProductCatalogImageSettingsInternal.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productCatalogImageSettingsInternal.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productCatalogImageSettingsInternal.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(Str APINodeList productCatalogImageSettingsInternals = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalogImageSettingsOperation.java b/src/main/java/com/facebook/ads/sdk/ProductCatalogImageSettingsOperation.java index 288d5f94..aec535b3 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalogImageSettingsOperation.java +++ b/src/main/java/com/facebook/ads/sdk/ProductCatalogImageSettingsOperation.java @@ -54,9 +54,8 @@ public String getId() { public static ProductCatalogImageSettingsOperation loadJSON(String json, APIContext context, String header) { ProductCatalogImageSettingsOperation productCatalogImageSettingsOperation = getGson().fromJson(json, ProductCatalogImageSettingsOperation.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productCatalogImageSettingsOperation.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productCatalogImageSettingsOperation.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(St APINodeList productCatalogImageSettingsOperations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalogLocalizationSettings.java b/src/main/java/com/facebook/ads/sdk/ProductCatalogLocalizationSettings.java index 565e055b..1b56e4b9 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalogLocalizationSettings.java +++ b/src/main/java/com/facebook/ads/sdk/ProductCatalogLocalizationSettings.java @@ -117,9 +117,8 @@ public String getId() { public static ProductCatalogLocalizationSettings loadJSON(String json, APIContext context, String header) { ProductCatalogLocalizationSettings productCatalogLocalizationSettings = getGson().fromJson(json, ProductCatalogLocalizationSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productCatalogLocalizationSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productCatalogLocalizationSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(Stri APINodeList productCatalogLocalizationSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalogPricingVariablesBatch.java b/src/main/java/com/facebook/ads/sdk/ProductCatalogPricingVariablesBatch.java index 15dc7f0a..667e452e 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalogPricingVariablesBatch.java +++ b/src/main/java/com/facebook/ads/sdk/ProductCatalogPricingVariablesBatch.java @@ -60,9 +60,8 @@ public String getId() { public static ProductCatalogPricingVariablesBatch loadJSON(String json, APIContext context, String header) { ProductCatalogPricingVariablesBatch productCatalogPricingVariablesBatch = getGson().fromJson(json, ProductCatalogPricingVariablesBatch.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productCatalogPricingVariablesBatch.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productCatalogPricingVariablesBatch.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(Str APINodeList productCatalogPricingVariablesBatchs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalogProductSetsBatch.java b/src/main/java/com/facebook/ads/sdk/ProductCatalogProductSetsBatch.java index 4f2840e1..e4752ceb 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalogProductSetsBatch.java +++ b/src/main/java/com/facebook/ads/sdk/ProductCatalogProductSetsBatch.java @@ -60,9 +60,8 @@ public String getId() { public static ProductCatalogProductSetsBatch loadJSON(String json, APIContext context, String header) { ProductCatalogProductSetsBatch productCatalogProductSetsBatch = getGson().fromJson(json, ProductCatalogProductSetsBatch.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productCatalogProductSetsBatch.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productCatalogProductSetsBatch.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String j APINodeList productCatalogProductSetsBatchs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalogUserActions.java b/src/main/java/com/facebook/ads/sdk/ProductCatalogUserActions.java index 88ec632b..3cce3ec0 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalogUserActions.java +++ b/src/main/java/com/facebook/ads/sdk/ProductCatalogUserActions.java @@ -54,9 +54,8 @@ public String getId() { public static ProductCatalogUserActions loadJSON(String json, APIContext context, String header) { ProductCatalogUserActions productCatalogUserActions = getGson().fromJson(json, ProductCatalogUserActions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productCatalogUserActions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productCatalogUserActions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APINodeList productCatalogUserActionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalogUserPermissions.java b/src/main/java/com/facebook/ads/sdk/ProductCatalogUserPermissions.java index 13bb461b..460dfaad 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalogUserPermissions.java +++ b/src/main/java/com/facebook/ads/sdk/ProductCatalogUserPermissions.java @@ -72,9 +72,8 @@ public String getId() { public static ProductCatalogUserPermissions loadJSON(String json, APIContext context, String header) { ProductCatalogUserPermissions productCatalogUserPermissions = getGson().fromJson(json, ProductCatalogUserPermissions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productCatalogUserPermissions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productCatalogUserPermissions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -94,10 +93,9 @@ public static APINodeList parseResponse(String js APINodeList productCatalogUserPermissionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductCatalogUserTasks.java b/src/main/java/com/facebook/ads/sdk/ProductCatalogUserTasks.java index 309677e9..c18bb7ce 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductCatalogUserTasks.java +++ b/src/main/java/com/facebook/ads/sdk/ProductCatalogUserTasks.java @@ -56,9 +56,8 @@ public String getId() { public static ProductCatalogUserTasks loadJSON(String json, APIContext context, String header) { ProductCatalogUserTasks productCatalogUserTasks = getGson().fromJson(json, ProductCatalogUserTasks.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productCatalogUserTasks.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productCatalogUserTasks.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, AP APINodeList productCatalogUserTaskss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductDaEventSamplesBatch.java b/src/main/java/com/facebook/ads/sdk/ProductDaEventSamplesBatch.java index 380c5c67..87339986 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductDaEventSamplesBatch.java +++ b/src/main/java/com/facebook/ads/sdk/ProductDaEventSamplesBatch.java @@ -58,9 +58,8 @@ public String getId() { public static ProductDaEventSamplesBatch loadJSON(String json, APIContext context, String header) { ProductDaEventSamplesBatch productDaEventSamplesBatch = getGson().fromJson(json, ProductDaEventSamplesBatch.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productDaEventSamplesBatch.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productDaEventSamplesBatch.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APINodeList productDaEventSamplesBatchs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductDeliveryPreference.java b/src/main/java/com/facebook/ads/sdk/ProductDeliveryPreference.java index 8c014da1..9d312029 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductDeliveryPreference.java +++ b/src/main/java/com/facebook/ads/sdk/ProductDeliveryPreference.java @@ -119,9 +119,8 @@ public String getId() { public static ProductDeliveryPreference loadJSON(String json, APIContext context, String header) { ProductDeliveryPreference productDeliveryPreference = getGson().fromJson(json, ProductDeliveryPreference.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productDeliveryPreference.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productDeliveryPreference.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, APINodeList productDeliveryPreferences = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductEventStat.java b/src/main/java/com/facebook/ads/sdk/ProductEventStat.java index 0a963b41..7cf51840 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductEventStat.java +++ b/src/main/java/com/facebook/ads/sdk/ProductEventStat.java @@ -74,9 +74,8 @@ public String getId() { public static ProductEventStat loadJSON(String json, APIContext context, String header) { ProductEventStat productEventStat = getGson().fromJson(json, ProductEventStat.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productEventStat.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productEventStat.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -96,10 +95,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList productEventStats = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductFeed.java b/src/main/java/com/facebook/ads/sdk/ProductFeed.java index 109e9c77..7e189511 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductFeed.java +++ b/src/main/java/com/facebook/ads/sdk/ProductFeed.java @@ -151,9 +151,8 @@ public String getId() { public static ProductFeed loadJSON(String json, APIContext context, String header) { ProductFeed productFeed = getGson().fromJson(json, ProductFeed.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productFeed.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productFeed.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -173,10 +172,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList productFeeds = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductFeedRule.java b/src/main/java/com/facebook/ads/sdk/ProductFeedRule.java index 78a4fa7e..edf9363c 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductFeedRule.java +++ b/src/main/java/com/facebook/ads/sdk/ProductFeedRule.java @@ -119,9 +119,8 @@ public String getId() { public static ProductFeedRule loadJSON(String json, APIContext context, String header) { ProductFeedRule productFeedRule = getGson().fromJson(json, ProductFeedRule.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productFeedRule.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productFeedRule.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList productFeedRules = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductFeedRulePreviewSample.java b/src/main/java/com/facebook/ads/sdk/ProductFeedRulePreviewSample.java index 018907ad..3dbfadf4 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductFeedRulePreviewSample.java +++ b/src/main/java/com/facebook/ads/sdk/ProductFeedRulePreviewSample.java @@ -56,9 +56,8 @@ public String getId() { public static ProductFeedRulePreviewSample loadJSON(String json, APIContext context, String header) { ProductFeedRulePreviewSample productFeedRulePreviewSample = getGson().fromJson(json, ProductFeedRulePreviewSample.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productFeedRulePreviewSample.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productFeedRulePreviewSample.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String jso APINodeList productFeedRulePreviewSamples = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductFeedRuleSuggestion.java b/src/main/java/com/facebook/ads/sdk/ProductFeedRuleSuggestion.java index a843fea4..18d4b6ae 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductFeedRuleSuggestion.java +++ b/src/main/java/com/facebook/ads/sdk/ProductFeedRuleSuggestion.java @@ -58,9 +58,8 @@ public String getId() { public static ProductFeedRuleSuggestion loadJSON(String json, APIContext context, String header) { ProductFeedRuleSuggestion productFeedRuleSuggestion = getGson().fromJson(json, ProductFeedRuleSuggestion.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productFeedRuleSuggestion.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productFeedRuleSuggestion.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APINodeList productFeedRuleSuggestions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductFeedSchedule.java b/src/main/java/com/facebook/ads/sdk/ProductFeedSchedule.java index 7a795ce9..37bc270d 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductFeedSchedule.java +++ b/src/main/java/com/facebook/ads/sdk/ProductFeedSchedule.java @@ -131,9 +131,8 @@ public String getId() { public static ProductFeedSchedule loadJSON(String json, APIContext context, String header) { ProductFeedSchedule productFeedSchedule = getGson().fromJson(json, ProductFeedSchedule.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productFeedSchedule.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productFeedSchedule.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -153,10 +152,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList productFeedSchedules = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductFeedUpload.java b/src/main/java/com/facebook/ads/sdk/ProductFeedUpload.java index 998ecf96..13ec834f 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductFeedUpload.java +++ b/src/main/java/com/facebook/ads/sdk/ProductFeedUpload.java @@ -137,9 +137,8 @@ public String getId() { public static ProductFeedUpload loadJSON(String json, APIContext context, String header) { ProductFeedUpload productFeedUpload = getGson().fromJson(json, ProductFeedUpload.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productFeedUpload.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productFeedUpload.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -159,10 +158,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList productFeedUploads = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductFeedUploadError.java b/src/main/java/com/facebook/ads/sdk/ProductFeedUploadError.java index 1ab155bc..42ee481e 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductFeedUploadError.java +++ b/src/main/java/com/facebook/ads/sdk/ProductFeedUploadError.java @@ -125,9 +125,8 @@ public String getId() { public static ProductFeedUploadError loadJSON(String json, APIContext context, String header) { ProductFeedUploadError productFeedUploadError = getGson().fromJson(json, ProductFeedUploadError.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productFeedUploadError.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productFeedUploadError.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, API APINodeList productFeedUploadErrors = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductFeedUploadErrorReport.java b/src/main/java/com/facebook/ads/sdk/ProductFeedUploadErrorReport.java index bbe82140..8cc88537 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductFeedUploadErrorReport.java +++ b/src/main/java/com/facebook/ads/sdk/ProductFeedUploadErrorReport.java @@ -56,9 +56,8 @@ public String getId() { public static ProductFeedUploadErrorReport loadJSON(String json, APIContext context, String header) { ProductFeedUploadErrorReport productFeedUploadErrorReport = getGson().fromJson(json, ProductFeedUploadErrorReport.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productFeedUploadErrorReport.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productFeedUploadErrorReport.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String jso APINodeList productFeedUploadErrorReports = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductFeedUploadErrorSample.java b/src/main/java/com/facebook/ads/sdk/ProductFeedUploadErrorSample.java index d7bd0bb0..b649776b 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductFeedUploadErrorSample.java +++ b/src/main/java/com/facebook/ads/sdk/ProductFeedUploadErrorSample.java @@ -117,9 +117,8 @@ public String getId() { public static ProductFeedUploadErrorSample loadJSON(String json, APIContext context, String header) { ProductFeedUploadErrorSample productFeedUploadErrorSample = getGson().fromJson(json, ProductFeedUploadErrorSample.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productFeedUploadErrorSample.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productFeedUploadErrorSample.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String jso APINodeList productFeedUploadErrorSamples = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductFeedUploadProgress.java b/src/main/java/com/facebook/ads/sdk/ProductFeedUploadProgress.java index 17cde5ea..6399c530 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductFeedUploadProgress.java +++ b/src/main/java/com/facebook/ads/sdk/ProductFeedUploadProgress.java @@ -62,9 +62,8 @@ public String getId() { public static ProductFeedUploadProgress loadJSON(String json, APIContext context, String header) { ProductFeedUploadProgress productFeedUploadProgress = getGson().fromJson(json, ProductFeedUploadProgress.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productFeedUploadProgress.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productFeedUploadProgress.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APINodeList productFeedUploadProgresss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductGroup.java b/src/main/java/com/facebook/ads/sdk/ProductGroup.java index e96aa431..87da6b2b 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductGroup.java +++ b/src/main/java/com/facebook/ads/sdk/ProductGroup.java @@ -119,9 +119,8 @@ public String getId() { public static ProductGroup loadJSON(String json, APIContext context, String header) { ProductGroup productGroup = getGson().fromJson(json, ProductGroup.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productGroup.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productGroup.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList productGroups = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductImage.java b/src/main/java/com/facebook/ads/sdk/ProductImage.java index ba80e0d9..93c37ad9 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductImage.java +++ b/src/main/java/com/facebook/ads/sdk/ProductImage.java @@ -119,9 +119,8 @@ public String getId() { public static ProductImage loadJSON(String json, APIContext context, String header) { ProductImage productImage = getGson().fromJson(json, ProductImage.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productImage.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productImage.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList productImages = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductItem.java b/src/main/java/com/facebook/ads/sdk/ProductItem.java index b7bd6a02..c7df8b91 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductItem.java +++ b/src/main/java/com/facebook/ads/sdk/ProductItem.java @@ -267,9 +267,8 @@ public String getId() { public static ProductItem loadJSON(String json, APIContext context, String header) { ProductItem productItem = getGson().fromJson(json, ProductItem.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productItem.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productItem.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -289,10 +288,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList productItems = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductItemCommerceInsights.java b/src/main/java/com/facebook/ads/sdk/ProductItemCommerceInsights.java index 63267eeb..a766c6cc 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductItemCommerceInsights.java +++ b/src/main/java/com/facebook/ads/sdk/ProductItemCommerceInsights.java @@ -58,9 +58,8 @@ public String getId() { public static ProductItemCommerceInsights loadJSON(String json, APIContext context, String header) { ProductItemCommerceInsights productItemCommerceInsights = getGson().fromJson(json, ProductItemCommerceInsights.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productItemCommerceInsights.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productItemCommerceInsights.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json APINodeList productItemCommerceInsightss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductItemError.java b/src/main/java/com/facebook/ads/sdk/ProductItemError.java index 666fcbb2..7b169cf3 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductItemError.java +++ b/src/main/java/com/facebook/ads/sdk/ProductItemError.java @@ -60,9 +60,8 @@ public String getId() { public static ProductItemError loadJSON(String json, APIContext context, String header) { ProductItemError productItemError = getGson().fromJson(json, ProductItemError.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productItemError.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productItemError.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList productItemErrors = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductItemImporterAddress.java b/src/main/java/com/facebook/ads/sdk/ProductItemImporterAddress.java index 948c28c0..fac56884 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductItemImporterAddress.java +++ b/src/main/java/com/facebook/ads/sdk/ProductItemImporterAddress.java @@ -64,9 +64,8 @@ public String getId() { public static ProductItemImporterAddress loadJSON(String json, APIContext context, String header) { ProductItemImporterAddress productItemImporterAddress = getGson().fromJson(json, ProductItemImporterAddress.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productItemImporterAddress.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productItemImporterAddress.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APINodeList productItemImporterAddresss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductItemInsights.java b/src/main/java/com/facebook/ads/sdk/ProductItemInsights.java index 17f44682..9f00d826 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductItemInsights.java +++ b/src/main/java/com/facebook/ads/sdk/ProductItemInsights.java @@ -62,9 +62,8 @@ public String getId() { public static ProductItemInsights loadJSON(String json, APIContext context, String header) { ProductItemInsights productItemInsights = getGson().fromJson(json, ProductItemInsights.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productItemInsights.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productItemInsights.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList productItemInsightss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductItemInvalidationError.java b/src/main/java/com/facebook/ads/sdk/ProductItemInvalidationError.java index 60187769..18b3063c 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductItemInvalidationError.java +++ b/src/main/java/com/facebook/ads/sdk/ProductItemInvalidationError.java @@ -52,9 +52,8 @@ public String getId() { public static ProductItemInvalidationError loadJSON(String json, APIContext context, String header) { ProductItemInvalidationError productItemInvalidationError = getGson().fromJson(json, ProductItemInvalidationError.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productItemInvalidationError.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productItemInvalidationError.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseResponse(String jso APINodeList productItemInvalidationErrors = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductItemLandingPageData.java b/src/main/java/com/facebook/ads/sdk/ProductItemLandingPageData.java index 7af5c32d..ac5f171b 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductItemLandingPageData.java +++ b/src/main/java/com/facebook/ads/sdk/ProductItemLandingPageData.java @@ -54,9 +54,8 @@ public String getId() { public static ProductItemLandingPageData loadJSON(String json, APIContext context, String header) { ProductItemLandingPageData productItemLandingPageData = getGson().fromJson(json, ProductItemLandingPageData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productItemLandingPageData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productItemLandingPageData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APINodeList productItemLandingPageDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductItemLocalInfo.java b/src/main/java/com/facebook/ads/sdk/ProductItemLocalInfo.java index 63aaafc9..bec86036 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductItemLocalInfo.java +++ b/src/main/java/com/facebook/ads/sdk/ProductItemLocalInfo.java @@ -129,9 +129,8 @@ public String getId() { public static ProductItemLocalInfo loadJSON(String json, APIContext context, String header) { ProductItemLocalInfo productItemLocalInfo = getGson().fromJson(json, ProductItemLocalInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productItemLocalInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productItemLocalInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList productItemLocalInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductItemLocalInfoLatLongShape.java b/src/main/java/com/facebook/ads/sdk/ProductItemLocalInfoLatLongShape.java index 6182cc88..54c2a293 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductItemLocalInfoLatLongShape.java +++ b/src/main/java/com/facebook/ads/sdk/ProductItemLocalInfoLatLongShape.java @@ -56,9 +56,8 @@ public String getId() { public static ProductItemLocalInfoLatLongShape loadJSON(String json, APIContext context, String header) { ProductItemLocalInfoLatLongShape productItemLocalInfoLatLongShape = getGson().fromJson(json, ProductItemLocalInfoLatLongShape.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productItemLocalInfoLatLongShape.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productItemLocalInfoLatLongShape.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String APINodeList productItemLocalInfoLatLongShapes = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductItemOffer.java b/src/main/java/com/facebook/ads/sdk/ProductItemOffer.java index 784f4f72..09957689 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductItemOffer.java +++ b/src/main/java/com/facebook/ads/sdk/ProductItemOffer.java @@ -117,9 +117,8 @@ public String getId() { public static ProductItemOffer loadJSON(String json, APIContext context, String header) { ProductItemOffer productItemOffer = getGson().fromJson(json, ProductItemOffer.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productItemOffer.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productItemOffer.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList productItemOffers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductItemShipping.java b/src/main/java/com/facebook/ads/sdk/ProductItemShipping.java index 47d4423b..7f8a3fff 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductItemShipping.java +++ b/src/main/java/com/facebook/ads/sdk/ProductItemShipping.java @@ -62,9 +62,8 @@ public String getId() { public static ProductItemShipping loadJSON(String json, APIContext context, String header) { ProductItemShipping productItemShipping = getGson().fromJson(json, ProductItemShipping.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productItemShipping.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productItemShipping.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList productItemShippings = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductItemSubscriptionInfo.java b/src/main/java/com/facebook/ads/sdk/ProductItemSubscriptionInfo.java index fff66ee2..77a87786 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductItemSubscriptionInfo.java +++ b/src/main/java/com/facebook/ads/sdk/ProductItemSubscriptionInfo.java @@ -58,9 +58,8 @@ public String getId() { public static ProductItemSubscriptionInfo loadJSON(String json, APIContext context, String header) { ProductItemSubscriptionInfo productItemSubscriptionInfo = getGson().fromJson(json, ProductItemSubscriptionInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productItemSubscriptionInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productItemSubscriptionInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json APINodeList productItemSubscriptionInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductItemUnitPrice.java b/src/main/java/com/facebook/ads/sdk/ProductItemUnitPrice.java index da4620f3..785faf43 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductItemUnitPrice.java +++ b/src/main/java/com/facebook/ads/sdk/ProductItemUnitPrice.java @@ -52,9 +52,8 @@ public String getId() { public static ProductItemUnitPrice loadJSON(String json, APIContext context, String header) { ProductItemUnitPrice productItemUnitPrice = getGson().fromJson(json, ProductItemUnitPrice.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productItemUnitPrice.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productItemUnitPrice.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList productItemUnitPrices = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductSet.java b/src/main/java/com/facebook/ads/sdk/ProductSet.java index 77dc2d00..5de30ddc 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductSet.java +++ b/src/main/java/com/facebook/ads/sdk/ProductSet.java @@ -131,9 +131,8 @@ public String getId() { public static ProductSet loadJSON(String json, APIContext context, String header) { ProductSet productSet = getGson().fromJson(json, ProductSet.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productSet.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productSet.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -153,10 +152,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList productSets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductSetMetadata.java b/src/main/java/com/facebook/ads/sdk/ProductSetMetadata.java index 1a60afe2..4bb58a8d 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductSetMetadata.java +++ b/src/main/java/com/facebook/ads/sdk/ProductSetMetadata.java @@ -60,9 +60,8 @@ public String getId() { public static ProductSetMetadata loadJSON(String json, APIContext context, String header) { ProductSetMetadata productSetMetadata = getGson().fromJson(json, ProductSetMetadata.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productSetMetadata.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productSetMetadata.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList productSetMetadatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductSetTaxonCategory.java b/src/main/java/com/facebook/ads/sdk/ProductSetTaxonCategory.java index 5ea3514c..db573be6 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductSetTaxonCategory.java +++ b/src/main/java/com/facebook/ads/sdk/ProductSetTaxonCategory.java @@ -58,9 +58,8 @@ public String getId() { public static ProductSetTaxonCategory loadJSON(String json, APIContext context, String header) { ProductSetTaxonCategory productSetTaxonCategory = getGson().fromJson(json, ProductSetTaxonCategory.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productSetTaxonCategory.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productSetTaxonCategory.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, AP APINodeList productSetTaxonCategorys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductSetUsage.java b/src/main/java/com/facebook/ads/sdk/ProductSetUsage.java index 8dd20da7..6ce54f92 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductSetUsage.java +++ b/src/main/java/com/facebook/ads/sdk/ProductSetUsage.java @@ -117,9 +117,8 @@ public String getId() { public static ProductSetUsage loadJSON(String json, APIContext context, String header) { ProductSetUsage productSetUsage = getGson().fromJson(json, ProductSetUsage.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productSetUsage.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productSetUsage.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList productSetUsages = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductVariant.java b/src/main/java/com/facebook/ads/sdk/ProductVariant.java index 38659e7d..b0d575ea 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductVariant.java +++ b/src/main/java/com/facebook/ads/sdk/ProductVariant.java @@ -58,9 +58,8 @@ public String getId() { public static ProductVariant loadJSON(String json, APIContext context, String header) { ProductVariant productVariant = getGson().fromJson(json, ProductVariant.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productVariant.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productVariant.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList productVariants = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProductVisualVariant.java b/src/main/java/com/facebook/ads/sdk/ProductVisualVariant.java index 05d538b7..efcce38a 100644 --- a/src/main/java/com/facebook/ads/sdk/ProductVisualVariant.java +++ b/src/main/java/com/facebook/ads/sdk/ProductVisualVariant.java @@ -56,9 +56,8 @@ public String getId() { public static ProductVisualVariant loadJSON(String json, APIContext context, String header) { ProductVisualVariant productVisualVariant = getGson().fromJson(json, ProductVisualVariant.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(productVisualVariant.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(productVisualVariant.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList productVisualVariants = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Profile.java b/src/main/java/com/facebook/ads/sdk/Profile.java index cf8bc9bd..dd869bde 100644 --- a/src/main/java/com/facebook/ads/sdk/Profile.java +++ b/src/main/java/com/facebook/ads/sdk/Profile.java @@ -133,9 +133,8 @@ public String getId() { public static Profile loadJSON(String json, APIContext context, String header) { Profile profile = getGson().fromJson(json, Profile.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(profile.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(profile.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -155,10 +154,9 @@ public static APINodeList parseResponse(String json, APIContext context APINodeList profiles = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ProfilePictureSource.java b/src/main/java/com/facebook/ads/sdk/ProfilePictureSource.java index e02c4be8..4acd7c87 100644 --- a/src/main/java/com/facebook/ads/sdk/ProfilePictureSource.java +++ b/src/main/java/com/facebook/ads/sdk/ProfilePictureSource.java @@ -70,9 +70,8 @@ public String getId() { public static ProfilePictureSource loadJSON(String json, APIContext context, String header) { ProfilePictureSource profilePictureSource = getGson().fromJson(json, ProfilePictureSource.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(profilePictureSource.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(profilePictureSource.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList profilePictureSources = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PublisherBlockList.java b/src/main/java/com/facebook/ads/sdk/PublisherBlockList.java index c2eb09da..dfcfff35 100644 --- a/src/main/java/com/facebook/ads/sdk/PublisherBlockList.java +++ b/src/main/java/com/facebook/ads/sdk/PublisherBlockList.java @@ -131,9 +131,8 @@ public String getId() { public static PublisherBlockList loadJSON(String json, APIContext context, String header) { PublisherBlockList publisherBlockList = getGson().fromJson(json, PublisherBlockList.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(publisherBlockList.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(publisherBlockList.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -153,10 +152,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList publisherBlockLists = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PublisherDeliveryReport.java b/src/main/java/com/facebook/ads/sdk/PublisherDeliveryReport.java index dad713f2..c076e34d 100644 --- a/src/main/java/com/facebook/ads/sdk/PublisherDeliveryReport.java +++ b/src/main/java/com/facebook/ads/sdk/PublisherDeliveryReport.java @@ -62,9 +62,8 @@ public String getId() { public static PublisherDeliveryReport loadJSON(String json, APIContext context, String header) { PublisherDeliveryReport publisherDeliveryReport = getGson().fromJson(json, PublisherDeliveryReport.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(publisherDeliveryReport.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(publisherDeliveryReport.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, AP APINodeList publisherDeliveryReports = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/PublisherWhiteList.java b/src/main/java/com/facebook/ads/sdk/PublisherWhiteList.java index c6c3213d..c3766ea9 100644 --- a/src/main/java/com/facebook/ads/sdk/PublisherWhiteList.java +++ b/src/main/java/com/facebook/ads/sdk/PublisherWhiteList.java @@ -123,9 +123,8 @@ public String getId() { public static PublisherWhiteList loadJSON(String json, APIContext context, String header) { PublisherWhiteList publisherWhiteList = getGson().fromJson(json, PublisherWhiteList.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(publisherWhiteList.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(publisherWhiteList.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList publisherWhiteLists = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/RTBDynamicPost.java b/src/main/java/com/facebook/ads/sdk/RTBDynamicPost.java index 1967fb21..bab12c34 100644 --- a/src/main/java/com/facebook/ads/sdk/RTBDynamicPost.java +++ b/src/main/java/com/facebook/ads/sdk/RTBDynamicPost.java @@ -133,9 +133,8 @@ public String getId() { public static RTBDynamicPost loadJSON(String json, APIContext context, String header) { RTBDynamicPost rtbDynamicPost = getGson().fromJson(json, RTBDynamicPost.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(rtbDynamicPost.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(rtbDynamicPost.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -155,10 +154,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList rtbDynamicPosts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/RawCustomAudience.java b/src/main/java/com/facebook/ads/sdk/RawCustomAudience.java index 4b2beda5..1e4bbbe4 100644 --- a/src/main/java/com/facebook/ads/sdk/RawCustomAudience.java +++ b/src/main/java/com/facebook/ads/sdk/RawCustomAudience.java @@ -56,9 +56,8 @@ public String getId() { public static RawCustomAudience loadJSON(String json, APIContext context, String header) { RawCustomAudience rawCustomAudience = getGson().fromJson(json, RawCustomAudience.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(rawCustomAudience.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(rawCustomAudience.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList rawCustomAudiences = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ReachFrequencyActivity.java b/src/main/java/com/facebook/ads/sdk/ReachFrequencyActivity.java index 03acda94..63286fa5 100644 --- a/src/main/java/com/facebook/ads/sdk/ReachFrequencyActivity.java +++ b/src/main/java/com/facebook/ads/sdk/ReachFrequencyActivity.java @@ -64,9 +64,8 @@ public String getId() { public static ReachFrequencyActivity loadJSON(String json, APIContext context, String header) { ReachFrequencyActivity reachFrequencyActivity = getGson().fromJson(json, ReachFrequencyActivity.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(reachFrequencyActivity.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(reachFrequencyActivity.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, API APINodeList reachFrequencyActivitys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ReachFrequencyAdFormat.java b/src/main/java/com/facebook/ads/sdk/ReachFrequencyAdFormat.java index 5379eed3..f7511b99 100644 --- a/src/main/java/com/facebook/ads/sdk/ReachFrequencyAdFormat.java +++ b/src/main/java/com/facebook/ads/sdk/ReachFrequencyAdFormat.java @@ -56,9 +56,8 @@ public String getId() { public static ReachFrequencyAdFormat loadJSON(String json, APIContext context, String header) { ReachFrequencyAdFormat reachFrequencyAdFormat = getGson().fromJson(json, ReachFrequencyAdFormat.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(reachFrequencyAdFormat.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(reachFrequencyAdFormat.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, API APINodeList reachFrequencyAdFormats = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ReachFrequencyCurveLowerConfidenceRange.java b/src/main/java/com/facebook/ads/sdk/ReachFrequencyCurveLowerConfidenceRange.java index e94c85d2..562c442f 100644 --- a/src/main/java/com/facebook/ads/sdk/ReachFrequencyCurveLowerConfidenceRange.java +++ b/src/main/java/com/facebook/ads/sdk/ReachFrequencyCurveLowerConfidenceRange.java @@ -64,9 +64,8 @@ public String getId() { public static ReachFrequencyCurveLowerConfidenceRange loadJSON(String json, APIContext context, String header) { ReachFrequencyCurveLowerConfidenceRange reachFrequencyCurveLowerConfidenceRange = getGson().fromJson(json, ReachFrequencyCurveLowerConfidenceRange.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(reachFrequencyCurveLowerConfidenceRange.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(reachFrequencyCurveLowerConfidenceRange.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse APINodeList reachFrequencyCurveLowerConfidenceRanges = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ReachFrequencyCurveUpperConfidenceRange.java b/src/main/java/com/facebook/ads/sdk/ReachFrequencyCurveUpperConfidenceRange.java index e703ad5f..38283b6a 100644 --- a/src/main/java/com/facebook/ads/sdk/ReachFrequencyCurveUpperConfidenceRange.java +++ b/src/main/java/com/facebook/ads/sdk/ReachFrequencyCurveUpperConfidenceRange.java @@ -64,9 +64,8 @@ public String getId() { public static ReachFrequencyCurveUpperConfidenceRange loadJSON(String json, APIContext context, String header) { ReachFrequencyCurveUpperConfidenceRange reachFrequencyCurveUpperConfidenceRange = getGson().fromJson(json, ReachFrequencyCurveUpperConfidenceRange.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(reachFrequencyCurveUpperConfidenceRange.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(reachFrequencyCurveUpperConfidenceRange.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse APINodeList reachFrequencyCurveUpperConfidenceRanges = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ReachFrequencyDayPart.java b/src/main/java/com/facebook/ads/sdk/ReachFrequencyDayPart.java index 8e05a096..1645ed65 100644 --- a/src/main/java/com/facebook/ads/sdk/ReachFrequencyDayPart.java +++ b/src/main/java/com/facebook/ads/sdk/ReachFrequencyDayPart.java @@ -58,9 +58,8 @@ public String getId() { public static ReachFrequencyDayPart loadJSON(String json, APIContext context, String header) { ReachFrequencyDayPart reachFrequencyDayPart = getGson().fromJson(json, ReachFrequencyDayPart.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(reachFrequencyDayPart.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(reachFrequencyDayPart.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList reachFrequencyDayParts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ReachFrequencyEstimatesCurve.java b/src/main/java/com/facebook/ads/sdk/ReachFrequencyEstimatesCurve.java index c479a4f4..f4c8db26 100644 --- a/src/main/java/com/facebook/ads/sdk/ReachFrequencyEstimatesCurve.java +++ b/src/main/java/com/facebook/ads/sdk/ReachFrequencyEstimatesCurve.java @@ -68,9 +68,8 @@ public String getId() { public static ReachFrequencyEstimatesCurve loadJSON(String json, APIContext context, String header) { ReachFrequencyEstimatesCurve reachFrequencyEstimatesCurve = getGson().fromJson(json, ReachFrequencyEstimatesCurve.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(reachFrequencyEstimatesCurve.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(reachFrequencyEstimatesCurve.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String jso APINodeList reachFrequencyEstimatesCurves = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ReachFrequencyEstimatesPlacementBreakdown.java b/src/main/java/com/facebook/ads/sdk/ReachFrequencyEstimatesPlacementBreakdown.java index c250aea4..0040de9c 100644 --- a/src/main/java/com/facebook/ads/sdk/ReachFrequencyEstimatesPlacementBreakdown.java +++ b/src/main/java/com/facebook/ads/sdk/ReachFrequencyEstimatesPlacementBreakdown.java @@ -84,9 +84,8 @@ public String getId() { public static ReachFrequencyEstimatesPlacementBreakdown loadJSON(String json, APIContext context, String header) { ReachFrequencyEstimatesPlacementBreakdown reachFrequencyEstimatesPlacementBreakdown = getGson().fromJson(json, ReachFrequencyEstimatesPlacementBreakdown.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(reachFrequencyEstimatesPlacementBreakdown.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(reachFrequencyEstimatesPlacementBreakdown.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -106,10 +105,9 @@ public static APINodeList parseRespon APINodeList reachFrequencyEstimatesPlacementBreakdowns = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ReachFrequencyPrediction.java b/src/main/java/com/facebook/ads/sdk/ReachFrequencyPrediction.java index ee9be136..987e0ae0 100644 --- a/src/main/java/com/facebook/ads/sdk/ReachFrequencyPrediction.java +++ b/src/main/java/com/facebook/ads/sdk/ReachFrequencyPrediction.java @@ -283,9 +283,8 @@ public String getId() { public static ReachFrequencyPrediction loadJSON(String json, APIContext context, String header) { ReachFrequencyPrediction reachFrequencyPrediction = getGson().fromJson(json, ReachFrequencyPrediction.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(reachFrequencyPrediction.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(reachFrequencyPrediction.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -305,10 +304,9 @@ public static APINodeList parseResponse(String json, A APINodeList reachFrequencyPredictions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ReachFrequencySpec.java b/src/main/java/com/facebook/ads/sdk/ReachFrequencySpec.java index fdb5a2ba..72d9e052 100644 --- a/src/main/java/com/facebook/ads/sdk/ReachFrequencySpec.java +++ b/src/main/java/com/facebook/ads/sdk/ReachFrequencySpec.java @@ -68,9 +68,8 @@ public String getId() { public static ReachFrequencySpec loadJSON(String json, APIContext context, String header) { ReachFrequencySpec reachFrequencySpec = getGson().fromJson(json, ReachFrequencySpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(reachFrequencySpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(reachFrequencySpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList reachFrequencySpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Recommendation.java b/src/main/java/com/facebook/ads/sdk/Recommendation.java index 0cacc341..d12f8f4a 100644 --- a/src/main/java/com/facebook/ads/sdk/Recommendation.java +++ b/src/main/java/com/facebook/ads/sdk/Recommendation.java @@ -68,9 +68,8 @@ public String getId() { public static Recommendation loadJSON(String json, APIContext context, String header) { Recommendation recommendation = getGson().fromJson(json, Recommendation.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(recommendation.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(recommendation.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList recommendations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/RecommendedIGMedia.java b/src/main/java/com/facebook/ads/sdk/RecommendedIGMedia.java index ceed7e36..e4d51ca0 100644 --- a/src/main/java/com/facebook/ads/sdk/RecommendedIGMedia.java +++ b/src/main/java/com/facebook/ads/sdk/RecommendedIGMedia.java @@ -56,9 +56,8 @@ public String getId() { public static RecommendedIGMedia loadJSON(String json, APIContext context, String header) { RecommendedIGMedia recommendedIGMedia = getGson().fromJson(json, RecommendedIGMedia.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(recommendedIGMedia.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(recommendedIGMedia.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList recommendedIGMedias = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/RecommendedPagePost.java b/src/main/java/com/facebook/ads/sdk/RecommendedPagePost.java index 1176492e..a5dfb119 100644 --- a/src/main/java/com/facebook/ads/sdk/RecommendedPagePost.java +++ b/src/main/java/com/facebook/ads/sdk/RecommendedPagePost.java @@ -58,9 +58,8 @@ public String getId() { public static RecommendedPagePost loadJSON(String json, APIContext context, String header) { RecommendedPagePost recommendedPagePost = getGson().fromJson(json, RecommendedPagePost.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(recommendedPagePost.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(recommendedPagePost.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList recommendedPagePosts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/RegionalRegulationIdentities.java b/src/main/java/com/facebook/ads/sdk/RegionalRegulationIdentities.java index 2f58178d..9e15318e 100644 --- a/src/main/java/com/facebook/ads/sdk/RegionalRegulationIdentities.java +++ b/src/main/java/com/facebook/ads/sdk/RegionalRegulationIdentities.java @@ -56,9 +56,8 @@ public String getId() { public static RegionalRegulationIdentities loadJSON(String json, APIContext context, String header) { RegionalRegulationIdentities regionalRegulationIdentities = getGson().fromJson(json, RegionalRegulationIdentities.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(regionalRegulationIdentities.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(regionalRegulationIdentities.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String jso APINodeList regionalRegulationIdentitiess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ReportingAudience.java b/src/main/java/com/facebook/ads/sdk/ReportingAudience.java index 967194f8..fb0f4712 100644 --- a/src/main/java/com/facebook/ads/sdk/ReportingAudience.java +++ b/src/main/java/com/facebook/ads/sdk/ReportingAudience.java @@ -58,9 +58,8 @@ public String getId() { public static ReportingAudience loadJSON(String json, APIContext context, String header) { ReportingAudience reportingAudience = getGson().fromJson(json, ReportingAudience.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(reportingAudience.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(reportingAudience.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList reportingAudiences = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ResearchPollStudy.java b/src/main/java/com/facebook/ads/sdk/ResearchPollStudy.java index d5c75268..3d4143e5 100644 --- a/src/main/java/com/facebook/ads/sdk/ResearchPollStudy.java +++ b/src/main/java/com/facebook/ads/sdk/ResearchPollStudy.java @@ -117,9 +117,8 @@ public String getId() { public static ResearchPollStudy loadJSON(String json, APIContext context, String header) { ResearchPollStudy researchPollStudy = getGson().fromJson(json, ResearchPollStudy.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(researchPollStudy.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(researchPollStudy.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList researchPollStudys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ResellerGuidance.java b/src/main/java/com/facebook/ads/sdk/ResellerGuidance.java index 8ec7acb1..7afd2378 100644 --- a/src/main/java/com/facebook/ads/sdk/ResellerGuidance.java +++ b/src/main/java/com/facebook/ads/sdk/ResellerGuidance.java @@ -80,9 +80,8 @@ public String getId() { public static ResellerGuidance loadJSON(String json, APIContext context, String header) { ResellerGuidance resellerGuidance = getGson().fromJson(json, ResellerGuidance.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(resellerGuidance.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(resellerGuidance.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -102,10 +101,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList resellerGuidances = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/RevSharePolicy.java b/src/main/java/com/facebook/ads/sdk/RevSharePolicy.java index a95b161d..4767eeed 100644 --- a/src/main/java/com/facebook/ads/sdk/RevSharePolicy.java +++ b/src/main/java/com/facebook/ads/sdk/RevSharePolicy.java @@ -56,9 +56,8 @@ public String getId() { public static RevSharePolicy loadJSON(String json, APIContext context, String header) { RevSharePolicy revSharePolicy = getGson().fromJson(json, RevSharePolicy.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(revSharePolicy.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(revSharePolicy.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList revSharePolicys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/RichMediaElement.java b/src/main/java/com/facebook/ads/sdk/RichMediaElement.java index 20b8e0c5..51319bf9 100644 --- a/src/main/java/com/facebook/ads/sdk/RichMediaElement.java +++ b/src/main/java/com/facebook/ads/sdk/RichMediaElement.java @@ -58,9 +58,8 @@ public String getId() { public static RichMediaElement loadJSON(String json, APIContext context, String header) { RichMediaElement richMediaElement = getGson().fromJson(json, RichMediaElement.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(richMediaElement.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(richMediaElement.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList richMediaElements = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/RightsManagerDataExport.java b/src/main/java/com/facebook/ads/sdk/RightsManagerDataExport.java index 303e784a..0be2e3bc 100644 --- a/src/main/java/com/facebook/ads/sdk/RightsManagerDataExport.java +++ b/src/main/java/com/facebook/ads/sdk/RightsManagerDataExport.java @@ -125,9 +125,8 @@ public String getId() { public static RightsManagerDataExport loadJSON(String json, APIContext context, String header) { RightsManagerDataExport rightsManagerDataExport = getGson().fromJson(json, RightsManagerDataExport.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(rightsManagerDataExport.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(rightsManagerDataExport.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, AP APINodeList rightsManagerDataExports = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/RightsManagerInsights.java b/src/main/java/com/facebook/ads/sdk/RightsManagerInsights.java index 2647a28c..b61fd7c3 100644 --- a/src/main/java/com/facebook/ads/sdk/RightsManagerInsights.java +++ b/src/main/java/com/facebook/ads/sdk/RightsManagerInsights.java @@ -62,9 +62,8 @@ public String getId() { public static RightsManagerInsights loadJSON(String json, APIContext context, String header) { RightsManagerInsights rightsManagerInsights = getGson().fromJson(json, RightsManagerInsights.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(rightsManagerInsights.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(rightsManagerInsights.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList rightsManagerInsightss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Robot.java b/src/main/java/com/facebook/ads/sdk/Robot.java index da6c12bd..0e01f038 100644 --- a/src/main/java/com/facebook/ads/sdk/Robot.java +++ b/src/main/java/com/facebook/ads/sdk/Robot.java @@ -135,9 +135,8 @@ public String getId() { public static Robot loadJSON(String json, APIContext context, String header) { Robot robot = getGson().fromJson(json, Robot.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(robot.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(robot.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -157,10 +156,9 @@ public static APINodeList parseResponse(String json, APIContext context, APINodeList robots = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/SalesRightsInventoryManagement.java b/src/main/java/com/facebook/ads/sdk/SalesRightsInventoryManagement.java index b5924462..637fe755 100644 --- a/src/main/java/com/facebook/ads/sdk/SalesRightsInventoryManagement.java +++ b/src/main/java/com/facebook/ads/sdk/SalesRightsInventoryManagement.java @@ -66,9 +66,8 @@ public String getId() { public static SalesRightsInventoryManagement loadJSON(String json, APIContext context, String header) { SalesRightsInventoryManagement salesRightsInventoryManagement = getGson().fromJson(json, SalesRightsInventoryManagement.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(salesRightsInventoryManagement.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(salesRightsInventoryManagement.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String j APINodeList salesRightsInventoryManagements = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/SavedAudience.java b/src/main/java/com/facebook/ads/sdk/SavedAudience.java index b9440387..d5ea6288 100644 --- a/src/main/java/com/facebook/ads/sdk/SavedAudience.java +++ b/src/main/java/com/facebook/ads/sdk/SavedAudience.java @@ -143,9 +143,8 @@ public String getId() { public static SavedAudience loadJSON(String json, APIContext context, String header) { SavedAudience savedAudience = getGson().fromJson(json, SavedAudience.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(savedAudience.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(savedAudience.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -165,10 +164,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList savedAudiences = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/SavedMessageResponse.java b/src/main/java/com/facebook/ads/sdk/SavedMessageResponse.java index 0a7ef0e0..426481b8 100644 --- a/src/main/java/com/facebook/ads/sdk/SavedMessageResponse.java +++ b/src/main/java/com/facebook/ads/sdk/SavedMessageResponse.java @@ -121,9 +121,8 @@ public String getId() { public static SavedMessageResponse loadJSON(String json, APIContext context, String header) { SavedMessageResponse savedMessageResponse = getGson().fromJson(json, SavedMessageResponse.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(savedMessageResponse.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(savedMessageResponse.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList savedMessageResponses = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ScheduledPost.java b/src/main/java/com/facebook/ads/sdk/ScheduledPost.java index 5636ae79..a3530686 100644 --- a/src/main/java/com/facebook/ads/sdk/ScheduledPost.java +++ b/src/main/java/com/facebook/ads/sdk/ScheduledPost.java @@ -86,9 +86,8 @@ public String getId() { public static ScheduledPost loadJSON(String json, APIContext context, String header) { ScheduledPost scheduledPost = getGson().fromJson(json, ScheduledPost.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(scheduledPost.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(scheduledPost.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -108,10 +107,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList scheduledPosts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ScimCompanyUserPhoneNumber.java b/src/main/java/com/facebook/ads/sdk/ScimCompanyUserPhoneNumber.java index fe3f42ee..7dabad2c 100644 --- a/src/main/java/com/facebook/ads/sdk/ScimCompanyUserPhoneNumber.java +++ b/src/main/java/com/facebook/ads/sdk/ScimCompanyUserPhoneNumber.java @@ -58,9 +58,8 @@ public String getId() { public static ScimCompanyUserPhoneNumber loadJSON(String json, APIContext context, String header) { ScimCompanyUserPhoneNumber scimCompanyUserPhoneNumber = getGson().fromJson(json, ScimCompanyUserPhoneNumber.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(scimCompanyUserPhoneNumber.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(scimCompanyUserPhoneNumber.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APINodeList scimCompanyUserPhoneNumbers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/SecuritySettings.java b/src/main/java/com/facebook/ads/sdk/SecuritySettings.java index 8a995524..312f09ba 100644 --- a/src/main/java/com/facebook/ads/sdk/SecuritySettings.java +++ b/src/main/java/com/facebook/ads/sdk/SecuritySettings.java @@ -52,9 +52,8 @@ public String getId() { public static SecuritySettings loadJSON(String json, APIContext context, String header) { SecuritySettings securitySettings = getGson().fromJson(json, SecuritySettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(securitySettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(securitySettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -74,10 +73,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList securitySettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ShadowIGHashtag.java b/src/main/java/com/facebook/ads/sdk/ShadowIGHashtag.java index ea9ccd80..dfec7adc 100644 --- a/src/main/java/com/facebook/ads/sdk/ShadowIGHashtag.java +++ b/src/main/java/com/facebook/ads/sdk/ShadowIGHashtag.java @@ -115,9 +115,8 @@ public String getId() { public static ShadowIGHashtag loadJSON(String json, APIContext context, String header) { ShadowIGHashtag shadowIGHashtag = getGson().fromJson(json, ShadowIGHashtag.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(shadowIGHashtag.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(shadowIGHashtag.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList shadowIGHashtags = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ShadowIGMediaBoostedInsightsResult.java b/src/main/java/com/facebook/ads/sdk/ShadowIGMediaBoostedInsightsResult.java index 1498e32d..0499e13e 100644 --- a/src/main/java/com/facebook/ads/sdk/ShadowIGMediaBoostedInsightsResult.java +++ b/src/main/java/com/facebook/ads/sdk/ShadowIGMediaBoostedInsightsResult.java @@ -64,9 +64,8 @@ public String getId() { public static ShadowIGMediaBoostedInsightsResult loadJSON(String json, APIContext context, String header) { ShadowIGMediaBoostedInsightsResult shadowIGMediaBoostedInsightsResult = getGson().fromJson(json, ShadowIGMediaBoostedInsightsResult.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(shadowIGMediaBoostedInsightsResult.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(shadowIGMediaBoostedInsightsResult.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(Stri APINodeList shadowIGMediaBoostedInsightsResults = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ShadowIGMediaBuilder.java b/src/main/java/com/facebook/ads/sdk/ShadowIGMediaBuilder.java index ca53892b..617a7fb3 100644 --- a/src/main/java/com/facebook/ads/sdk/ShadowIGMediaBuilder.java +++ b/src/main/java/com/facebook/ads/sdk/ShadowIGMediaBuilder.java @@ -121,9 +121,8 @@ public String getId() { public static ShadowIGMediaBuilder loadJSON(String json, APIContext context, String header) { ShadowIGMediaBuilder shadowIGMediaBuilder = getGson().fromJson(json, ShadowIGMediaBuilder.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(shadowIGMediaBuilder.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(shadowIGMediaBuilder.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList shadowIGMediaBuilders = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ShadowIGMediaCollaborators.java b/src/main/java/com/facebook/ads/sdk/ShadowIGMediaCollaborators.java index 88dc65e4..6d733a51 100644 --- a/src/main/java/com/facebook/ads/sdk/ShadowIGMediaCollaborators.java +++ b/src/main/java/com/facebook/ads/sdk/ShadowIGMediaCollaborators.java @@ -58,9 +58,8 @@ public String getId() { public static ShadowIGMediaCollaborators loadJSON(String json, APIContext context, String header) { ShadowIGMediaCollaborators shadowIGMediaCollaborators = getGson().fromJson(json, ShadowIGMediaCollaborators.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(shadowIGMediaCollaborators.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(shadowIGMediaCollaborators.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APINodeList shadowIGMediaCollaboratorss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ShadowIGMediaProductTags.java b/src/main/java/com/facebook/ads/sdk/ShadowIGMediaProductTags.java index 97fdde06..0881d6cb 100644 --- a/src/main/java/com/facebook/ads/sdk/ShadowIGMediaProductTags.java +++ b/src/main/java/com/facebook/ads/sdk/ShadowIGMediaProductTags.java @@ -74,9 +74,8 @@ public String getId() { public static ShadowIGMediaProductTags loadJSON(String json, APIContext context, String header) { ShadowIGMediaProductTags shadowIGMediaProductTags = getGson().fromJson(json, ShadowIGMediaProductTags.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(shadowIGMediaProductTags.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(shadowIGMediaProductTags.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -96,10 +95,9 @@ public static APINodeList parseResponse(String json, A APINodeList shadowIGMediaProductTagss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ShadowIGUserCatalogProductSearch.java b/src/main/java/com/facebook/ads/sdk/ShadowIGUserCatalogProductSearch.java index d09ebfb4..ad9baeee 100644 --- a/src/main/java/com/facebook/ads/sdk/ShadowIGUserCatalogProductSearch.java +++ b/src/main/java/com/facebook/ads/sdk/ShadowIGUserCatalogProductSearch.java @@ -68,9 +68,8 @@ public String getId() { public static ShadowIGUserCatalogProductSearch loadJSON(String json, APIContext context, String header) { ShadowIGUserCatalogProductSearch shadowIGUserCatalogProductSearch = getGson().fromJson(json, ShadowIGUserCatalogProductSearch.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(shadowIGUserCatalogProductSearch.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(shadowIGUserCatalogProductSearch.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String APINodeList shadowIGUserCatalogProductSearchs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ShadowIGUserCatalogProductVariant.java b/src/main/java/com/facebook/ads/sdk/ShadowIGUserCatalogProductVariant.java index d8145c3f..8f9edc87 100644 --- a/src/main/java/com/facebook/ads/sdk/ShadowIGUserCatalogProductVariant.java +++ b/src/main/java/com/facebook/ads/sdk/ShadowIGUserCatalogProductVariant.java @@ -56,9 +56,8 @@ public String getId() { public static ShadowIGUserCatalogProductVariant loadJSON(String json, APIContext context, String header) { ShadowIGUserCatalogProductVariant shadowIGUserCatalogProductVariant = getGson().fromJson(json, ShadowIGUserCatalogProductVariant.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(shadowIGUserCatalogProductVariant.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(shadowIGUserCatalogProductVariant.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(Strin APINodeList shadowIGUserCatalogProductVariants = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ShadowIGUserPartnershipAdsMediaErrors.java b/src/main/java/com/facebook/ads/sdk/ShadowIGUserPartnershipAdsMediaErrors.java index a3f2528b..3e677370 100644 --- a/src/main/java/com/facebook/ads/sdk/ShadowIGUserPartnershipAdsMediaErrors.java +++ b/src/main/java/com/facebook/ads/sdk/ShadowIGUserPartnershipAdsMediaErrors.java @@ -60,9 +60,8 @@ public String getId() { public static ShadowIGUserPartnershipAdsMediaErrors loadJSON(String json, APIContext context, String header) { ShadowIGUserPartnershipAdsMediaErrors shadowIGUserPartnershipAdsMediaErrors = getGson().fromJson(json, ShadowIGUserPartnershipAdsMediaErrors.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(shadowIGUserPartnershipAdsMediaErrors.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(shadowIGUserPartnershipAdsMediaErrors.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(S APINodeList shadowIGUserPartnershipAdsMediaErrorss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Shop.java b/src/main/java/com/facebook/ads/sdk/Shop.java index 7259d8d4..59b0000f 100644 --- a/src/main/java/com/facebook/ads/sdk/Shop.java +++ b/src/main/java/com/facebook/ads/sdk/Shop.java @@ -125,9 +125,8 @@ public String getId() { public static Shop loadJSON(String json, APIContext context, String header) { Shop shop = getGson().fromJson(json, Shop.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(shop.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(shop.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, APIContext context, A APINodeList shops = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/SignalsIWLExtractor.java b/src/main/java/com/facebook/ads/sdk/SignalsIWLExtractor.java index 2a263078..ffdbb556 100644 --- a/src/main/java/com/facebook/ads/sdk/SignalsIWLExtractor.java +++ b/src/main/java/com/facebook/ads/sdk/SignalsIWLExtractor.java @@ -119,9 +119,8 @@ public String getId() { public static SignalsIWLExtractor loadJSON(String json, APIContext context, String header) { SignalsIWLExtractor signalsIWLExtractor = getGson().fromJson(json, SignalsIWLExtractor.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(signalsIWLExtractor.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(signalsIWLExtractor.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList signalsIWLExtractors = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/SingleOwnerAdditionalProfile.java b/src/main/java/com/facebook/ads/sdk/SingleOwnerAdditionalProfile.java index f289b424..5cfa4b9d 100644 --- a/src/main/java/com/facebook/ads/sdk/SingleOwnerAdditionalProfile.java +++ b/src/main/java/com/facebook/ads/sdk/SingleOwnerAdditionalProfile.java @@ -58,9 +58,8 @@ public String getId() { public static SingleOwnerAdditionalProfile loadJSON(String json, APIContext context, String header) { SingleOwnerAdditionalProfile singleOwnerAdditionalProfile = getGson().fromJson(json, SingleOwnerAdditionalProfile.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(singleOwnerAdditionalProfile.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(singleOwnerAdditionalProfile.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String jso APINodeList singleOwnerAdditionalProfiles = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/SiteLink.java b/src/main/java/com/facebook/ads/sdk/SiteLink.java index dd283ea5..f7d06139 100644 --- a/src/main/java/com/facebook/ads/sdk/SiteLink.java +++ b/src/main/java/com/facebook/ads/sdk/SiteLink.java @@ -121,9 +121,8 @@ public String getId() { public static SiteLink loadJSON(String json, APIContext context, String header) { SiteLink siteLink = getGson().fromJson(json, SiteLink.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(siteLink.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(siteLink.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList siteLinks = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/SlicedEventSourceGroup.java b/src/main/java/com/facebook/ads/sdk/SlicedEventSourceGroup.java index cecb22f5..60611e74 100644 --- a/src/main/java/com/facebook/ads/sdk/SlicedEventSourceGroup.java +++ b/src/main/java/com/facebook/ads/sdk/SlicedEventSourceGroup.java @@ -119,9 +119,8 @@ public String getId() { public static SlicedEventSourceGroup loadJSON(String json, APIContext context, String header) { SlicedEventSourceGroup slicedEventSourceGroup = getGson().fromJson(json, SlicedEventSourceGroup.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(slicedEventSourceGroup.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(slicedEventSourceGroup.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, API APINodeList slicedEventSourceGroups = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/SmartPixelInsights.java b/src/main/java/com/facebook/ads/sdk/SmartPixelInsights.java index 5f7d7b32..edaedb3d 100644 --- a/src/main/java/com/facebook/ads/sdk/SmartPixelInsights.java +++ b/src/main/java/com/facebook/ads/sdk/SmartPixelInsights.java @@ -56,9 +56,8 @@ public String getId() { public static SmartPixelInsights loadJSON(String json, APIContext context, String header) { SmartPixelInsights smartPixelInsights = getGson().fromJson(json, SmartPixelInsights.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(smartPixelInsights.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(smartPixelInsights.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList smartPixelInsightss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/SocialWifiSite.java b/src/main/java/com/facebook/ads/sdk/SocialWifiSite.java index bac2d286..134664d2 100644 --- a/src/main/java/com/facebook/ads/sdk/SocialWifiSite.java +++ b/src/main/java/com/facebook/ads/sdk/SocialWifiSite.java @@ -54,9 +54,8 @@ public String getId() { public static SocialWifiSite loadJSON(String json, APIContext context, String header) { SocialWifiSite socialWifiSite = getGson().fromJson(json, SocialWifiSite.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(socialWifiSite.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(socialWifiSite.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList socialWifiSites = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/SplitTestConfig.java b/src/main/java/com/facebook/ads/sdk/SplitTestConfig.java index dec55d57..6756d233 100644 --- a/src/main/java/com/facebook/ads/sdk/SplitTestConfig.java +++ b/src/main/java/com/facebook/ads/sdk/SplitTestConfig.java @@ -125,9 +125,8 @@ public String getId() { public static SplitTestConfig loadJSON(String json, APIContext context, String header) { SplitTestConfig splitTestConfig = getGson().fromJson(json, SplitTestConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(splitTestConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(splitTestConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList splitTestConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/SplitTestWinner.java b/src/main/java/com/facebook/ads/sdk/SplitTestWinner.java index b79fa0f1..781047c2 100644 --- a/src/main/java/com/facebook/ads/sdk/SplitTestWinner.java +++ b/src/main/java/com/facebook/ads/sdk/SplitTestWinner.java @@ -58,9 +58,8 @@ public String getId() { public static SplitTestWinner loadJSON(String json, APIContext context, String header) { SplitTestWinner splitTestWinner = getGson().fromJson(json, SplitTestWinner.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(splitTestWinner.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(splitTestWinner.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList splitTestWinners = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Status.java b/src/main/java/com/facebook/ads/sdk/Status.java index 2fb5f09d..49f3e2c1 100644 --- a/src/main/java/com/facebook/ads/sdk/Status.java +++ b/src/main/java/com/facebook/ads/sdk/Status.java @@ -123,9 +123,8 @@ public String getId() { public static Status loadJSON(String json, APIContext context, String header) { Status status = getGson().fromJson(json, Status.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(status.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(status.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String json, APIContext context, APINodeList statuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/StoreCatalogSettings.java b/src/main/java/com/facebook/ads/sdk/StoreCatalogSettings.java index c278ae5e..a965c17c 100644 --- a/src/main/java/com/facebook/ads/sdk/StoreCatalogSettings.java +++ b/src/main/java/com/facebook/ads/sdk/StoreCatalogSettings.java @@ -115,9 +115,8 @@ public String getId() { public static StoreCatalogSettings loadJSON(String json, APIContext context, String header) { StoreCatalogSettings storeCatalogSettings = getGson().fromJson(json, StoreCatalogSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(storeCatalogSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(storeCatalogSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList storeCatalogSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Stories.java b/src/main/java/com/facebook/ads/sdk/Stories.java index a84ab64c..701c26b6 100644 --- a/src/main/java/com/facebook/ads/sdk/Stories.java +++ b/src/main/java/com/facebook/ads/sdk/Stories.java @@ -125,9 +125,8 @@ public String getId() { public static Stories loadJSON(String json, APIContext context, String header) { Stories stories = getGson().fromJson(json, Stories.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(stories.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(stories.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, APIContext context APINodeList storiess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/StreamFilter.java b/src/main/java/com/facebook/ads/sdk/StreamFilter.java index 538e36d2..8895837a 100644 --- a/src/main/java/com/facebook/ads/sdk/StreamFilter.java +++ b/src/main/java/com/facebook/ads/sdk/StreamFilter.java @@ -58,9 +58,8 @@ public String getId() { public static StreamFilter loadJSON(String json, APIContext context, String header) { StreamFilter streamFilter = getGson().fromJson(json, StreamFilter.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(streamFilter.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(streamFilter.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList streamFilters = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/SystemUser.java b/src/main/java/com/facebook/ads/sdk/SystemUser.java index 8ef7afd4..b0355bc6 100644 --- a/src/main/java/com/facebook/ads/sdk/SystemUser.java +++ b/src/main/java/com/facebook/ads/sdk/SystemUser.java @@ -123,9 +123,8 @@ public String getId() { public static SystemUser loadJSON(String json, APIContext context, String header) { SystemUser systemUser = getGson().fromJson(json, SystemUser.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(systemUser.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(systemUser.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList systemUsers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Tab.java b/src/main/java/com/facebook/ads/sdk/Tab.java index a523d2fb..cfd5a6fd 100644 --- a/src/main/java/com/facebook/ads/sdk/Tab.java +++ b/src/main/java/com/facebook/ads/sdk/Tab.java @@ -72,9 +72,8 @@ public String getId() { public static Tab loadJSON(String json, APIContext context, String header) { Tab tab = getGson().fromJson(json, Tab.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(tab.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(tab.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -94,10 +93,9 @@ public static APINodeList parseResponse(String json, APIContext context, AP APINodeList tabs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TaggableSubject.java b/src/main/java/com/facebook/ads/sdk/TaggableSubject.java index 2aa37015..3233cf57 100644 --- a/src/main/java/com/facebook/ads/sdk/TaggableSubject.java +++ b/src/main/java/com/facebook/ads/sdk/TaggableSubject.java @@ -56,9 +56,8 @@ public String getId() { public static TaggableSubject loadJSON(String json, APIContext context, String header) { TaggableSubject taggableSubject = getGson().fromJson(json, TaggableSubject.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(taggableSubject.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(taggableSubject.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList taggableSubjects = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Targeting.java b/src/main/java/com/facebook/ads/sdk/Targeting.java index b0026661..21490225 100644 --- a/src/main/java/com/facebook/ads/sdk/Targeting.java +++ b/src/main/java/com/facebook/ads/sdk/Targeting.java @@ -236,9 +236,8 @@ public String getId() { public static Targeting loadJSON(String json, APIContext context, String header) { Targeting targeting = getGson().fromJson(json, Targeting.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targeting.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targeting.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -258,10 +257,9 @@ public static APINodeList parseResponse(String json, APIContext conte APINodeList targetings = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingAutomation.java b/src/main/java/com/facebook/ads/sdk/TargetingAutomation.java index a1430f4a..25e3b92f 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingAutomation.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingAutomation.java @@ -60,9 +60,8 @@ public String getId() { public static TargetingAutomation loadJSON(String json, APIContext context, String header) { TargetingAutomation targetingAutomation = getGson().fromJson(json, TargetingAutomation.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingAutomation.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingAutomation.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList targetingAutomations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingDynamicRule.java b/src/main/java/com/facebook/ads/sdk/TargetingDynamicRule.java index 47d64c32..0b81dd1c 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingDynamicRule.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingDynamicRule.java @@ -68,9 +68,8 @@ public String getId() { public static TargetingDynamicRule loadJSON(String json, APIContext context, String header) { TargetingDynamicRule targetingDynamicRule = getGson().fromJson(json, TargetingDynamicRule.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingDynamicRule.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingDynamicRule.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -90,10 +89,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList targetingDynamicRules = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocation.java b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocation.java index 2b0a1730..87c2cba1 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocation.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocation.java @@ -90,9 +90,8 @@ public String getId() { public static TargetingGeoLocation loadJSON(String json, APIContext context, String header) { TargetingGeoLocation targetingGeoLocation = getGson().fromJson(json, TargetingGeoLocation.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingGeoLocation.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingGeoLocation.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -112,10 +111,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList targetingGeoLocations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationCity.java b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationCity.java index 831fe94d..525f17e9 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationCity.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationCity.java @@ -66,9 +66,8 @@ public String getId() { public static TargetingGeoLocationCity loadJSON(String json, APIContext context, String header) { TargetingGeoLocationCity targetingGeoLocationCity = getGson().fromJson(json, TargetingGeoLocationCity.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingGeoLocationCity.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingGeoLocationCity.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, A APINodeList targetingGeoLocationCitys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationCustomLocation.java b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationCustomLocation.java index 3c5329a5..78f728ef 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationCustomLocation.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationCustomLocation.java @@ -80,9 +80,8 @@ public String getId() { public static TargetingGeoLocationCustomLocation loadJSON(String json, APIContext context, String header) { TargetingGeoLocationCustomLocation targetingGeoLocationCustomLocation = getGson().fromJson(json, TargetingGeoLocationCustomLocation.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingGeoLocationCustomLocation.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingGeoLocationCustomLocation.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -102,10 +101,9 @@ public static APINodeList parseResponse(Stri APINodeList targetingGeoLocationCustomLocations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationElectoralDistrict.java b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationElectoralDistrict.java index 14f2afcf..9a0d4d8e 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationElectoralDistrict.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationElectoralDistrict.java @@ -62,9 +62,8 @@ public String getId() { public static TargetingGeoLocationElectoralDistrict loadJSON(String json, APIContext context, String header) { TargetingGeoLocationElectoralDistrict targetingGeoLocationElectoralDistrict = getGson().fromJson(json, TargetingGeoLocationElectoralDistrict.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingGeoLocationElectoralDistrict.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingGeoLocationElectoralDistrict.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(S APINodeList targetingGeoLocationElectoralDistricts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationGeoEntities.java b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationGeoEntities.java index a9948986..1ea8a8df 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationGeoEntities.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationGeoEntities.java @@ -62,9 +62,8 @@ public String getId() { public static TargetingGeoLocationGeoEntities loadJSON(String json, APIContext context, String header) { TargetingGeoLocationGeoEntities targetingGeoLocationGeoEntities = getGson().fromJson(json, TargetingGeoLocationGeoEntities.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingGeoLocationGeoEntities.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingGeoLocationGeoEntities.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String APINodeList targetingGeoLocationGeoEntitiess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationLocationCluster.java b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationLocationCluster.java index 5ffa0a12..98d82b5a 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationLocationCluster.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationLocationCluster.java @@ -54,9 +54,8 @@ public String getId() { public static TargetingGeoLocationLocationCluster loadJSON(String json, APIContext context, String header) { TargetingGeoLocationLocationCluster targetingGeoLocationLocationCluster = getGson().fromJson(json, TargetingGeoLocationLocationCluster.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingGeoLocationLocationCluster.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingGeoLocationLocationCluster.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(Str APINodeList targetingGeoLocationLocationClusters = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationLocationExpansion.java b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationLocationExpansion.java index 696ae7e3..753af22a 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationLocationExpansion.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationLocationExpansion.java @@ -56,9 +56,8 @@ public String getId() { public static TargetingGeoLocationLocationExpansion loadJSON(String json, APIContext context, String header) { TargetingGeoLocationLocationExpansion targetingGeoLocationLocationExpansion = getGson().fromJson(json, TargetingGeoLocationLocationExpansion.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingGeoLocationLocationExpansion.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingGeoLocationLocationExpansion.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(S APINodeList targetingGeoLocationLocationExpansions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationMarket.java b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationMarket.java index 549e21f4..970a50b8 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationMarket.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationMarket.java @@ -60,9 +60,8 @@ public String getId() { public static TargetingGeoLocationMarket loadJSON(String json, APIContext context, String header) { TargetingGeoLocationMarket targetingGeoLocationMarket = getGson().fromJson(json, TargetingGeoLocationMarket.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingGeoLocationMarket.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingGeoLocationMarket.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APINodeList targetingGeoLocationMarkets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationPlace.java b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationPlace.java index b0857952..07fdcfb3 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationPlace.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationPlace.java @@ -70,9 +70,8 @@ public String getId() { public static TargetingGeoLocationPlace loadJSON(String json, APIContext context, String header) { TargetingGeoLocationPlace targetingGeoLocationPlace = getGson().fromJson(json, TargetingGeoLocationPlace.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingGeoLocationPlace.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingGeoLocationPlace.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -92,10 +91,9 @@ public static APINodeList parseResponse(String json, APINodeList targetingGeoLocationPlaces = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationPoliticalDistrict.java b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationPoliticalDistrict.java index e2a309f3..4bca2a99 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationPoliticalDistrict.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationPoliticalDistrict.java @@ -60,9 +60,8 @@ public String getId() { public static TargetingGeoLocationPoliticalDistrict loadJSON(String json, APIContext context, String header) { TargetingGeoLocationPoliticalDistrict targetingGeoLocationPoliticalDistrict = getGson().fromJson(json, TargetingGeoLocationPoliticalDistrict.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingGeoLocationPoliticalDistrict.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingGeoLocationPoliticalDistrict.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(S APINodeList targetingGeoLocationPoliticalDistricts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationRegion.java b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationRegion.java index 9451afd6..7b19eaec 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationRegion.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationRegion.java @@ -58,9 +58,8 @@ public String getId() { public static TargetingGeoLocationRegion loadJSON(String json, APIContext context, String header) { TargetingGeoLocationRegion targetingGeoLocationRegion = getGson().fromJson(json, TargetingGeoLocationRegion.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingGeoLocationRegion.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingGeoLocationRegion.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APINodeList targetingGeoLocationRegions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationZip.java b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationZip.java index a5b99cd8..4b1863ee 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationZip.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingGeoLocationZip.java @@ -62,9 +62,8 @@ public String getId() { public static TargetingGeoLocationZip loadJSON(String json, APIContext context, String header) { TargetingGeoLocationZip targetingGeoLocationZip = getGson().fromJson(json, TargetingGeoLocationZip.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingGeoLocationZip.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingGeoLocationZip.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, AP APINodeList targetingGeoLocationZips = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingMarketingMessageChannels.java b/src/main/java/com/facebook/ads/sdk/TargetingMarketingMessageChannels.java index fd9207b1..fc85ab75 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingMarketingMessageChannels.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingMarketingMessageChannels.java @@ -54,9 +54,8 @@ public String getId() { public static TargetingMarketingMessageChannels loadJSON(String json, APIContext context, String header) { TargetingMarketingMessageChannels targetingMarketingMessageChannels = getGson().fromJson(json, TargetingMarketingMessageChannels.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingMarketingMessageChannels.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingMarketingMessageChannels.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(Strin APINodeList targetingMarketingMessageChannelss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingProductAudienceSpec.java b/src/main/java/com/facebook/ads/sdk/TargetingProductAudienceSpec.java index eb788012..0ebf6878 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingProductAudienceSpec.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingProductAudienceSpec.java @@ -58,9 +58,8 @@ public String getId() { public static TargetingProductAudienceSpec loadJSON(String json, APIContext context, String header) { TargetingProductAudienceSpec targetingProductAudienceSpec = getGson().fromJson(json, TargetingProductAudienceSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingProductAudienceSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingProductAudienceSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String jso APINodeList targetingProductAudienceSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingProductAudienceSubSpec.java b/src/main/java/com/facebook/ads/sdk/TargetingProductAudienceSubSpec.java index e2738017..160f0dd9 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingProductAudienceSubSpec.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingProductAudienceSubSpec.java @@ -56,9 +56,8 @@ public String getId() { public static TargetingProductAudienceSubSpec loadJSON(String json, APIContext context, String header) { TargetingProductAudienceSubSpec targetingProductAudienceSubSpec = getGson().fromJson(json, TargetingProductAudienceSubSpec.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingProductAudienceSubSpec.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingProductAudienceSubSpec.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String APINodeList targetingProductAudienceSubSpecs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingProspectingAudience.java b/src/main/java/com/facebook/ads/sdk/TargetingProspectingAudience.java index 141f0f4b..e6c198e2 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingProspectingAudience.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingProspectingAudience.java @@ -54,9 +54,8 @@ public String getId() { public static TargetingProspectingAudience loadJSON(String json, APIContext context, String header) { TargetingProspectingAudience targetingProspectingAudience = getGson().fromJson(json, TargetingProspectingAudience.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingProspectingAudience.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingProspectingAudience.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String jso APINodeList targetingProspectingAudiences = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingRelaxation.java b/src/main/java/com/facebook/ads/sdk/TargetingRelaxation.java index 7aa6617d..e42ca4b0 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingRelaxation.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingRelaxation.java @@ -56,9 +56,8 @@ public String getId() { public static TargetingRelaxation loadJSON(String json, APIContext context, String header) { TargetingRelaxation targetingRelaxation = getGson().fromJson(json, TargetingRelaxation.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingRelaxation.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingRelaxation.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList targetingRelaxations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TargetingSentenceLine.java b/src/main/java/com/facebook/ads/sdk/TargetingSentenceLine.java index 1da5b2f4..e9b2a0b4 100644 --- a/src/main/java/com/facebook/ads/sdk/TargetingSentenceLine.java +++ b/src/main/java/com/facebook/ads/sdk/TargetingSentenceLine.java @@ -58,9 +58,8 @@ public String getId() { public static TargetingSentenceLine loadJSON(String json, APIContext context, String header) { TargetingSentenceLine targetingSentenceLine = getGson().fromJson(json, TargetingSentenceLine.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(targetingSentenceLine.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(targetingSentenceLine.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList targetingSentenceLines = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TextWithEntities.java b/src/main/java/com/facebook/ads/sdk/TextWithEntities.java index 3541d5f2..a7b59ee5 100644 --- a/src/main/java/com/facebook/ads/sdk/TextWithEntities.java +++ b/src/main/java/com/facebook/ads/sdk/TextWithEntities.java @@ -54,9 +54,8 @@ public String getId() { public static TextWithEntities loadJSON(String json, APIContext context, String header) { TextWithEntities textWithEntities = getGson().fromJson(json, TextWithEntities.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(textWithEntities.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(textWithEntities.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -76,10 +75,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList textWithEntitiess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ThirdPartyMeasurementReportDataset.java b/src/main/java/com/facebook/ads/sdk/ThirdPartyMeasurementReportDataset.java index 6f272fc5..5cb8a53b 100644 --- a/src/main/java/com/facebook/ads/sdk/ThirdPartyMeasurementReportDataset.java +++ b/src/main/java/com/facebook/ads/sdk/ThirdPartyMeasurementReportDataset.java @@ -121,9 +121,8 @@ public String getId() { public static ThirdPartyMeasurementReportDataset loadJSON(String json, APIContext context, String header) { ThirdPartyMeasurementReportDataset thirdPartyMeasurementReportDataset = getGson().fromJson(json, ThirdPartyMeasurementReportDataset.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(thirdPartyMeasurementReportDataset.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(thirdPartyMeasurementReportDataset.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(Stri APINodeList thirdPartyMeasurementReportDatasets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerLiftRequest.java b/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerLiftRequest.java index 5e367cc0..89247e03 100644 --- a/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerLiftRequest.java +++ b/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerLiftRequest.java @@ -137,9 +137,8 @@ public String getId() { public static ThirdPartyPartnerLiftRequest loadJSON(String json, APIContext context, String header) { ThirdPartyPartnerLiftRequest thirdPartyPartnerLiftRequest = getGson().fromJson(json, ThirdPartyPartnerLiftRequest.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(thirdPartyPartnerLiftRequest.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(thirdPartyPartnerLiftRequest.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -159,10 +158,9 @@ public static APINodeList parseResponse(String jso APINodeList thirdPartyPartnerLiftRequests = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerPanelRequest.java b/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerPanelRequest.java index 5ef26353..f04eaf38 100644 --- a/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerPanelRequest.java +++ b/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerPanelRequest.java @@ -137,9 +137,8 @@ public String getId() { public static ThirdPartyPartnerPanelRequest loadJSON(String json, APIContext context, String header) { ThirdPartyPartnerPanelRequest thirdPartyPartnerPanelRequest = getGson().fromJson(json, ThirdPartyPartnerPanelRequest.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(thirdPartyPartnerPanelRequest.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(thirdPartyPartnerPanelRequest.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -159,10 +158,9 @@ public static APINodeList parseResponse(String js APINodeList thirdPartyPartnerPanelRequests = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerPanelScheduled.java b/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerPanelScheduled.java index 9a28587c..da37c596 100644 --- a/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerPanelScheduled.java +++ b/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerPanelScheduled.java @@ -139,9 +139,8 @@ public String getId() { public static ThirdPartyPartnerPanelScheduled loadJSON(String json, APIContext context, String header) { ThirdPartyPartnerPanelScheduled thirdPartyPartnerPanelScheduled = getGson().fromJson(json, ThirdPartyPartnerPanelScheduled.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(thirdPartyPartnerPanelScheduled.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(thirdPartyPartnerPanelScheduled.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -161,10 +160,9 @@ public static APINodeList parseResponse(String APINodeList thirdPartyPartnerPanelScheduleds = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerViewabilityRequest.java b/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerViewabilityRequest.java index e8e88a05..516fe698 100644 --- a/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerViewabilityRequest.java +++ b/src/main/java/com/facebook/ads/sdk/ThirdPartyPartnerViewabilityRequest.java @@ -131,9 +131,8 @@ public String getId() { public static ThirdPartyPartnerViewabilityRequest loadJSON(String json, APIContext context, String header) { ThirdPartyPartnerViewabilityRequest thirdPartyPartnerViewabilityRequest = getGson().fromJson(json, ThirdPartyPartnerViewabilityRequest.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(thirdPartyPartnerViewabilityRequest.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(thirdPartyPartnerViewabilityRequest.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -153,10 +152,9 @@ public static APINodeList parseResponse(Str APINodeList thirdPartyPartnerViewabilityRequests = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TimeSuggestion.java b/src/main/java/com/facebook/ads/sdk/TimeSuggestion.java index 1f32e743..69dc5b58 100644 --- a/src/main/java/com/facebook/ads/sdk/TimeSuggestion.java +++ b/src/main/java/com/facebook/ads/sdk/TimeSuggestion.java @@ -56,9 +56,8 @@ public String getId() { public static TimeSuggestion loadJSON(String json, APIContext context, String header) { TimeSuggestion timeSuggestion = getGson().fromJson(json, TimeSuggestion.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(timeSuggestion.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(timeSuggestion.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList timeSuggestions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TimezoneOffset.java b/src/main/java/com/facebook/ads/sdk/TimezoneOffset.java index 05fd4e2a..61f4ea07 100644 --- a/src/main/java/com/facebook/ads/sdk/TimezoneOffset.java +++ b/src/main/java/com/facebook/ads/sdk/TimezoneOffset.java @@ -62,9 +62,8 @@ public String getId() { public static TimezoneOffset loadJSON(String json, APIContext context, String header) { TimezoneOffset timezoneOffset = getGson().fromJson(json, TimezoneOffset.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(timezoneOffset.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(timezoneOffset.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList timezoneOffsets = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TrackingAndConversionWithDefaults.java b/src/main/java/com/facebook/ads/sdk/TrackingAndConversionWithDefaults.java index 57cea832..942ccb09 100644 --- a/src/main/java/com/facebook/ads/sdk/TrackingAndConversionWithDefaults.java +++ b/src/main/java/com/facebook/ads/sdk/TrackingAndConversionWithDefaults.java @@ -60,9 +60,8 @@ public String getId() { public static TrackingAndConversionWithDefaults loadJSON(String json, APIContext context, String header) { TrackingAndConversionWithDefaults trackingAndConversionWithDefaults = getGson().fromJson(json, TrackingAndConversionWithDefaults.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(trackingAndConversionWithDefaults.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(trackingAndConversionWithDefaults.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(Strin APINodeList trackingAndConversionWithDefaultss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/TransactableItem.java b/src/main/java/com/facebook/ads/sdk/TransactableItem.java index c579e0a7..7b3bd9ff 100644 --- a/src/main/java/com/facebook/ads/sdk/TransactableItem.java +++ b/src/main/java/com/facebook/ads/sdk/TransactableItem.java @@ -151,9 +151,8 @@ public String getId() { public static TransactableItem loadJSON(String json, APIContext context, String header) { TransactableItem transactableItem = getGson().fromJson(json, TransactableItem.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(transactableItem.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(transactableItem.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -173,10 +172,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList transactableItems = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Transaction.java b/src/main/java/com/facebook/ads/sdk/Transaction.java index 874e91b6..8964ad17 100644 --- a/src/main/java/com/facebook/ads/sdk/Transaction.java +++ b/src/main/java/com/facebook/ads/sdk/Transaction.java @@ -96,9 +96,8 @@ public String getId() { public static Transaction loadJSON(String json, APIContext context, String header) { Transaction transaction = getGson().fromJson(json, Transaction.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(transaction.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(transaction.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -118,10 +117,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList transactions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/URL.java b/src/main/java/com/facebook/ads/sdk/URL.java index b6fe7705..49226709 100644 --- a/src/main/java/com/facebook/ads/sdk/URL.java +++ b/src/main/java/com/facebook/ads/sdk/URL.java @@ -121,9 +121,8 @@ public String getId() { public static URL loadJSON(String json, APIContext context, String header) { URL url = getGson().fromJson(json, URL.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(url.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(url.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -143,10 +142,9 @@ public static APINodeList parseResponse(String json, APIContext context, AP APINodeList urls = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/UnifiedThread.java b/src/main/java/com/facebook/ads/sdk/UnifiedThread.java index a9cd7b13..f9de1170 100644 --- a/src/main/java/com/facebook/ads/sdk/UnifiedThread.java +++ b/src/main/java/com/facebook/ads/sdk/UnifiedThread.java @@ -145,9 +145,8 @@ public String getId() { public static UnifiedThread loadJSON(String json, APIContext context, String header) { UnifiedThread unifiedThread = getGson().fromJson(json, UnifiedThread.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(unifiedThread.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(unifiedThread.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -167,10 +166,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList unifiedThreads = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/UniqueAdCreative.java b/src/main/java/com/facebook/ads/sdk/UniqueAdCreative.java index eec0c502..a09df7da 100644 --- a/src/main/java/com/facebook/ads/sdk/UniqueAdCreative.java +++ b/src/main/java/com/facebook/ads/sdk/UniqueAdCreative.java @@ -56,9 +56,8 @@ public String getId() { public static UniqueAdCreative loadJSON(String json, APIContext context, String header) { UniqueAdCreative uniqueAdCreative = getGson().fromJson(json, UniqueAdCreative.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(uniqueAdCreative.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(uniqueAdCreative.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList uniqueAdCreatives = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/User.java b/src/main/java/com/facebook/ads/sdk/User.java index a6815189..a747c72f 100644 --- a/src/main/java/com/facebook/ads/sdk/User.java +++ b/src/main/java/com/facebook/ads/sdk/User.java @@ -209,9 +209,8 @@ public String getId() { public static User loadJSON(String json, APIContext context, String header) { User user = getGson().fromJson(json, User.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(user.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(user.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -231,10 +230,9 @@ public static APINodeList parseResponse(String json, APIContext context, A APINodeList users = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/UserAvailableCatalogs.java b/src/main/java/com/facebook/ads/sdk/UserAvailableCatalogs.java index d2520735..12d766d8 100644 --- a/src/main/java/com/facebook/ads/sdk/UserAvailableCatalogs.java +++ b/src/main/java/com/facebook/ads/sdk/UserAvailableCatalogs.java @@ -60,9 +60,8 @@ public String getId() { public static UserAvailableCatalogs loadJSON(String json, APIContext context, String header) { UserAvailableCatalogs userAvailableCatalogs = getGson().fromJson(json, UserAvailableCatalogs.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(userAvailableCatalogs.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(userAvailableCatalogs.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList userAvailableCatalogss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/UserContext.java b/src/main/java/com/facebook/ads/sdk/UserContext.java index f34925ba..d0717382 100644 --- a/src/main/java/com/facebook/ads/sdk/UserContext.java +++ b/src/main/java/com/facebook/ads/sdk/UserContext.java @@ -113,9 +113,8 @@ public String getId() { public static UserContext loadJSON(String json, APIContext context, String header) { UserContext userContext = getGson().fromJson(json, UserContext.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(userContext.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(userContext.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -135,10 +134,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList userContexts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/UserCoverPhoto.java b/src/main/java/com/facebook/ads/sdk/UserCoverPhoto.java index 547c5646..bf98d016 100644 --- a/src/main/java/com/facebook/ads/sdk/UserCoverPhoto.java +++ b/src/main/java/com/facebook/ads/sdk/UserCoverPhoto.java @@ -58,9 +58,8 @@ public String getId() { public static UserCoverPhoto loadJSON(String json, APIContext context, String header) { UserCoverPhoto userCoverPhoto = getGson().fromJson(json, UserCoverPhoto.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(userCoverPhoto.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(userCoverPhoto.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList userCoverPhotos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/UserDevice.java b/src/main/java/com/facebook/ads/sdk/UserDevice.java index 62a01541..55db29ea 100644 --- a/src/main/java/com/facebook/ads/sdk/UserDevice.java +++ b/src/main/java/com/facebook/ads/sdk/UserDevice.java @@ -56,9 +56,8 @@ public String getId() { public static UserDevice loadJSON(String json, APIContext context, String header) { UserDevice userDevice = getGson().fromJson(json, UserDevice.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(userDevice.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(userDevice.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList userDevices = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/UserIDForApp.java b/src/main/java/com/facebook/ads/sdk/UserIDForApp.java index fb93edf6..3687fd6c 100644 --- a/src/main/java/com/facebook/ads/sdk/UserIDForApp.java +++ b/src/main/java/com/facebook/ads/sdk/UserIDForApp.java @@ -56,9 +56,8 @@ public String getId() { public static UserIDForApp loadJSON(String json, APIContext context, String header) { UserIDForApp userIDForApp = getGson().fromJson(json, UserIDForApp.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(userIDForApp.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(userIDForApp.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList userIDForApps = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/UserIDForPage.java b/src/main/java/com/facebook/ads/sdk/UserIDForPage.java index da8844b6..f31b1af3 100644 --- a/src/main/java/com/facebook/ads/sdk/UserIDForPage.java +++ b/src/main/java/com/facebook/ads/sdk/UserIDForPage.java @@ -56,9 +56,8 @@ public String getId() { public static UserIDForPage loadJSON(String json, APIContext context, String header) { UserIDForPage userIDForPage = getGson().fromJson(json, UserIDForPage.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(userIDForPage.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(userIDForPage.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext c APINodeList userIDForPages = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/UserLeadGenDisclaimerResponse.java b/src/main/java/com/facebook/ads/sdk/UserLeadGenDisclaimerResponse.java index 6594bf6c..6bd12d46 100644 --- a/src/main/java/com/facebook/ads/sdk/UserLeadGenDisclaimerResponse.java +++ b/src/main/java/com/facebook/ads/sdk/UserLeadGenDisclaimerResponse.java @@ -56,9 +56,8 @@ public String getId() { public static UserLeadGenDisclaimerResponse loadJSON(String json, APIContext context, String header) { UserLeadGenDisclaimerResponse userLeadGenDisclaimerResponse = getGson().fromJson(json, UserLeadGenDisclaimerResponse.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(userLeadGenDisclaimerResponse.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(userLeadGenDisclaimerResponse.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String js APINodeList userLeadGenDisclaimerResponses = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/UserLeadGenFieldData.java b/src/main/java/com/facebook/ads/sdk/UserLeadGenFieldData.java index 469461da..34577b91 100644 --- a/src/main/java/com/facebook/ads/sdk/UserLeadGenFieldData.java +++ b/src/main/java/com/facebook/ads/sdk/UserLeadGenFieldData.java @@ -56,9 +56,8 @@ public String getId() { public static UserLeadGenFieldData loadJSON(String json, APIContext context, String header) { UserLeadGenFieldData userLeadGenFieldData = getGson().fromJson(json, UserLeadGenFieldData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(userLeadGenFieldData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(userLeadGenFieldData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APICo APINodeList userLeadGenFieldDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/UserMobileConfig.java b/src/main/java/com/facebook/ads/sdk/UserMobileConfig.java index ebee645e..f6077ad9 100644 --- a/src/main/java/com/facebook/ads/sdk/UserMobileConfig.java +++ b/src/main/java/com/facebook/ads/sdk/UserMobileConfig.java @@ -56,9 +56,8 @@ public String getId() { public static UserMobileConfig loadJSON(String json, APIContext context, String header) { UserMobileConfig userMobileConfig = getGson().fromJson(json, UserMobileConfig.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(userMobileConfig.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(userMobileConfig.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList userMobileConfigs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/UserNotificationSeenStateData.java b/src/main/java/com/facebook/ads/sdk/UserNotificationSeenStateData.java index 43625575..9cc7d09f 100644 --- a/src/main/java/com/facebook/ads/sdk/UserNotificationSeenStateData.java +++ b/src/main/java/com/facebook/ads/sdk/UserNotificationSeenStateData.java @@ -56,9 +56,8 @@ public String getId() { public static UserNotificationSeenStateData loadJSON(String json, APIContext context, String header) { UserNotificationSeenStateData userNotificationSeenStateData = getGson().fromJson(json, UserNotificationSeenStateData.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(userNotificationSeenStateData.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(userNotificationSeenStateData.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String js APINodeList userNotificationSeenStateDatas = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/UserPageOneTimeOptInTokenSettings.java b/src/main/java/com/facebook/ads/sdk/UserPageOneTimeOptInTokenSettings.java index 6cd88a71..6f275968 100644 --- a/src/main/java/com/facebook/ads/sdk/UserPageOneTimeOptInTokenSettings.java +++ b/src/main/java/com/facebook/ads/sdk/UserPageOneTimeOptInTokenSettings.java @@ -133,9 +133,8 @@ public String getId() { public static UserPageOneTimeOptInTokenSettings loadJSON(String json, APIContext context, String header) { UserPageOneTimeOptInTokenSettings userPageOneTimeOptInTokenSettings = getGson().fromJson(json, UserPageOneTimeOptInTokenSettings.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(userPageOneTimeOptInTokenSettings.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(userPageOneTimeOptInTokenSettings.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -155,10 +154,9 @@ public static APINodeList parseResponse(Strin APINodeList userPageOneTimeOptInTokenSettingss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/UserPaymentMethodsInfo.java b/src/main/java/com/facebook/ads/sdk/UserPaymentMethodsInfo.java index 0fbcb72c..798fde8f 100644 --- a/src/main/java/com/facebook/ads/sdk/UserPaymentMethodsInfo.java +++ b/src/main/java/com/facebook/ads/sdk/UserPaymentMethodsInfo.java @@ -66,9 +66,8 @@ public String getId() { public static UserPaymentMethodsInfo loadJSON(String json, APIContext context, String header) { UserPaymentMethodsInfo userPaymentMethodsInfo = getGson().fromJson(json, UserPaymentMethodsInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(userPaymentMethodsInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(userPaymentMethodsInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, API APINodeList userPaymentMethodsInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/UserPaymentMobilePricepoints.java b/src/main/java/com/facebook/ads/sdk/UserPaymentMobilePricepoints.java index a0f00ba2..96b4ad7d 100644 --- a/src/main/java/com/facebook/ads/sdk/UserPaymentMobilePricepoints.java +++ b/src/main/java/com/facebook/ads/sdk/UserPaymentMobilePricepoints.java @@ -60,9 +60,8 @@ public String getId() { public static UserPaymentMobilePricepoints loadJSON(String json, APIContext context, String header) { UserPaymentMobilePricepoints userPaymentMobilePricepoints = getGson().fromJson(json, UserPaymentMobilePricepoints.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(userPaymentMobilePricepoints.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(userPaymentMobilePricepoints.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String jso APINodeList userPaymentMobilePricepointss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/UserPaymentModulesOptions.java b/src/main/java/com/facebook/ads/sdk/UserPaymentModulesOptions.java index 71d179f7..fb9b9790 100644 --- a/src/main/java/com/facebook/ads/sdk/UserPaymentModulesOptions.java +++ b/src/main/java/com/facebook/ads/sdk/UserPaymentModulesOptions.java @@ -60,9 +60,8 @@ public String getId() { public static UserPaymentModulesOptions loadJSON(String json, APIContext context, String header) { UserPaymentModulesOptions userPaymentModulesOptions = getGson().fromJson(json, UserPaymentModulesOptions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(userPaymentModulesOptions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(userPaymentModulesOptions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APINodeList userPaymentModulesOptionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/ValueBasedEligibleSource.java b/src/main/java/com/facebook/ads/sdk/ValueBasedEligibleSource.java index c6d83049..d7a4b47e 100644 --- a/src/main/java/com/facebook/ads/sdk/ValueBasedEligibleSource.java +++ b/src/main/java/com/facebook/ads/sdk/ValueBasedEligibleSource.java @@ -58,9 +58,8 @@ public String getId() { public static ValueBasedEligibleSource loadJSON(String json, APIContext context, String header) { ValueBasedEligibleSource valueBasedEligibleSource = getGson().fromJson(json, ValueBasedEligibleSource.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(valueBasedEligibleSource.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(valueBasedEligibleSource.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, A APINodeList valueBasedEligibleSources = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/Vehicle.java b/src/main/java/com/facebook/ads/sdk/Vehicle.java index 354dfa54..fae95bab 100644 --- a/src/main/java/com/facebook/ads/sdk/Vehicle.java +++ b/src/main/java/com/facebook/ads/sdk/Vehicle.java @@ -217,9 +217,8 @@ public String getId() { public static Vehicle loadJSON(String json, APIContext context, String header) { Vehicle vehicle = getGson().fromJson(json, Vehicle.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(vehicle.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(vehicle.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -239,10 +238,9 @@ public static APINodeList parseResponse(String json, APIContext context APINodeList vehicles = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VehicleOffer.java b/src/main/java/com/facebook/ads/sdk/VehicleOffer.java index a13a1a14..ea8e93cc 100644 --- a/src/main/java/com/facebook/ads/sdk/VehicleOffer.java +++ b/src/main/java/com/facebook/ads/sdk/VehicleOffer.java @@ -211,9 +211,8 @@ public String getId() { public static VehicleOffer loadJSON(String json, APIContext context, String header) { VehicleOffer vehicleOffer = getGson().fromJson(json, VehicleOffer.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(vehicleOffer.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(vehicleOffer.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -233,10 +232,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList vehicleOffers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoCopyright.java b/src/main/java/com/facebook/ads/sdk/VideoCopyright.java index 0ba760d1..32b4c076 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoCopyright.java +++ b/src/main/java/com/facebook/ads/sdk/VideoCopyright.java @@ -143,9 +143,8 @@ public String getId() { public static VideoCopyright loadJSON(String json, APIContext context, String header) { VideoCopyright videoCopyright = getGson().fromJson(json, VideoCopyright.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoCopyright.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoCopyright.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -165,10 +164,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList videoCopyrights = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoCopyrightCheckStatus.java b/src/main/java/com/facebook/ads/sdk/VideoCopyrightCheckStatus.java index 4dbc5a78..7e63520e 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoCopyrightCheckStatus.java +++ b/src/main/java/com/facebook/ads/sdk/VideoCopyrightCheckStatus.java @@ -56,9 +56,8 @@ public String getId() { public static VideoCopyrightCheckStatus loadJSON(String json, APIContext context, String header) { VideoCopyrightCheckStatus videoCopyrightCheckStatus = getGson().fromJson(json, VideoCopyrightCheckStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoCopyrightCheckStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoCopyrightCheckStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APINodeList videoCopyrightCheckStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoCopyrightConditionGroup.java b/src/main/java/com/facebook/ads/sdk/VideoCopyrightConditionGroup.java index b4790927..b5b9d313 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoCopyrightConditionGroup.java +++ b/src/main/java/com/facebook/ads/sdk/VideoCopyrightConditionGroup.java @@ -58,9 +58,8 @@ public String getId() { public static VideoCopyrightConditionGroup loadJSON(String json, APIContext context, String header) { VideoCopyrightConditionGroup videoCopyrightConditionGroup = getGson().fromJson(json, VideoCopyrightConditionGroup.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoCopyrightConditionGroup.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoCopyrightConditionGroup.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String jso APINodeList videoCopyrightConditionGroups = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoCopyrightGeoGate.java b/src/main/java/com/facebook/ads/sdk/VideoCopyrightGeoGate.java index 20587504..c0ef3938 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoCopyrightGeoGate.java +++ b/src/main/java/com/facebook/ads/sdk/VideoCopyrightGeoGate.java @@ -56,9 +56,8 @@ public String getId() { public static VideoCopyrightGeoGate loadJSON(String json, APIContext context, String header) { VideoCopyrightGeoGate videoCopyrightGeoGate = getGson().fromJson(json, VideoCopyrightGeoGate.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoCopyrightGeoGate.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoCopyrightGeoGate.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList videoCopyrightGeoGates = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoCopyrightMatch.java b/src/main/java/com/facebook/ads/sdk/VideoCopyrightMatch.java index 2d68fe19..ec225e49 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoCopyrightMatch.java +++ b/src/main/java/com/facebook/ads/sdk/VideoCopyrightMatch.java @@ -125,9 +125,8 @@ public String getId() { public static VideoCopyrightMatch loadJSON(String json, APIContext context, String header) { VideoCopyrightMatch videoCopyrightMatch = getGson().fromJson(json, VideoCopyrightMatch.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoCopyrightMatch.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoCopyrightMatch.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList videoCopyrightMatchs = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoCopyrightRule.java b/src/main/java/com/facebook/ads/sdk/VideoCopyrightRule.java index 878bcd36..ad118f34 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoCopyrightRule.java +++ b/src/main/java/com/facebook/ads/sdk/VideoCopyrightRule.java @@ -125,9 +125,8 @@ public String getId() { public static VideoCopyrightRule loadJSON(String json, APIContext context, String header) { VideoCopyrightRule videoCopyrightRule = getGson().fromJson(json, VideoCopyrightRule.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoCopyrightRule.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoCopyrightRule.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList videoCopyrightRules = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoCopyrightSegment.java b/src/main/java/com/facebook/ads/sdk/VideoCopyrightSegment.java index 458e237c..3d88b3ed 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoCopyrightSegment.java +++ b/src/main/java/com/facebook/ads/sdk/VideoCopyrightSegment.java @@ -58,9 +58,8 @@ public String getId() { public static VideoCopyrightSegment loadJSON(String json, APIContext context, String header) { VideoCopyrightSegment videoCopyrightSegment = getGson().fromJson(json, VideoCopyrightSegment.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoCopyrightSegment.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoCopyrightSegment.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIC APINodeList videoCopyrightSegments = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoGroup.java b/src/main/java/com/facebook/ads/sdk/VideoGroup.java index f40b3ed5..17913c41 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoGroup.java +++ b/src/main/java/com/facebook/ads/sdk/VideoGroup.java @@ -86,9 +86,8 @@ public String getId() { public static VideoGroup loadJSON(String json, APIContext context, String header) { VideoGroup videoGroup = getGson().fromJson(json, VideoGroup.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoGroup.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoGroup.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -108,10 +107,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList videoGroups = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoList.java b/src/main/java/com/facebook/ads/sdk/VideoList.java index bf7eb621..bfa35cf4 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoList.java +++ b/src/main/java/com/facebook/ads/sdk/VideoList.java @@ -129,9 +129,8 @@ public String getId() { public static VideoList loadJSON(String json, APIContext context, String header) { VideoList videoList = getGson().fromJson(json, VideoList.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoList.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoList.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -151,10 +150,9 @@ public static APINodeList parseResponse(String json, APIContext conte APINodeList videoLists = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoMetricsReport.java b/src/main/java/com/facebook/ads/sdk/VideoMetricsReport.java index fe0bb813..10ad1cf8 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoMetricsReport.java +++ b/src/main/java/com/facebook/ads/sdk/VideoMetricsReport.java @@ -133,9 +133,8 @@ public String getId() { public static VideoMetricsReport loadJSON(String json, APIContext context, String header) { VideoMetricsReport videoMetricsReport = getGson().fromJson(json, VideoMetricsReport.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoMetricsReport.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoMetricsReport.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -155,10 +154,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList videoMetricsReports = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoPoll.java b/src/main/java/com/facebook/ads/sdk/VideoPoll.java index d674b867..19fb7fc0 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoPoll.java +++ b/src/main/java/com/facebook/ads/sdk/VideoPoll.java @@ -125,9 +125,8 @@ public String getId() { public static VideoPoll loadJSON(String json, APIContext context, String header) { VideoPoll videoPoll = getGson().fromJson(json, VideoPoll.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoPoll.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoPoll.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -147,10 +146,9 @@ public static APINodeList parseResponse(String json, APIContext conte APINodeList videoPolls = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoStats.java b/src/main/java/com/facebook/ads/sdk/VideoStats.java index 40bd66e5..5c6e431e 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoStats.java +++ b/src/main/java/com/facebook/ads/sdk/VideoStats.java @@ -64,9 +64,8 @@ public String getId() { public static VideoStats loadJSON(String json, APIContext context, String header) { VideoStats videoStats = getGson().fromJson(json, VideoStats.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoStats.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoStats.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList videoStatss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoStatus.java b/src/main/java/com/facebook/ads/sdk/VideoStatus.java index 67a9e8cd..8d1ddfc1 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoStatus.java +++ b/src/main/java/com/facebook/ads/sdk/VideoStatus.java @@ -64,9 +64,8 @@ public String getId() { public static VideoStatus loadJSON(String json, APIContext context, String header) { VideoStatus videoStatus = getGson().fromJson(json, VideoStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -86,10 +85,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList videoStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoStatusError.java b/src/main/java/com/facebook/ads/sdk/VideoStatusError.java index 51e9fe32..059d4550 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoStatusError.java +++ b/src/main/java/com/facebook/ads/sdk/VideoStatusError.java @@ -56,9 +56,8 @@ public String getId() { public static VideoStatusError loadJSON(String json, APIContext context, String header) { VideoStatusError videoStatusError = getGson().fromJson(json, VideoStatusError.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoStatusError.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoStatusError.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContex APINodeList videoStatusErrors = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoStatusProcessingPhase.java b/src/main/java/com/facebook/ads/sdk/VideoStatusProcessingPhase.java index 4f4f0c33..75488b2b 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoStatusProcessingPhase.java +++ b/src/main/java/com/facebook/ads/sdk/VideoStatusProcessingPhase.java @@ -56,9 +56,8 @@ public String getId() { public static VideoStatusProcessingPhase loadJSON(String json, APIContext context, String header) { VideoStatusProcessingPhase videoStatusProcessingPhase = getGson().fromJson(json, VideoStatusProcessingPhase.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoStatusProcessingPhase.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoStatusProcessingPhase.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APINodeList videoStatusProcessingPhases = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoStatusPublishingPhase.java b/src/main/java/com/facebook/ads/sdk/VideoStatusPublishingPhase.java index 537ac1f1..3215f9f6 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoStatusPublishingPhase.java +++ b/src/main/java/com/facebook/ads/sdk/VideoStatusPublishingPhase.java @@ -60,9 +60,8 @@ public String getId() { public static VideoStatusPublishingPhase loadJSON(String json, APIContext context, String header) { VideoStatusPublishingPhase videoStatusPublishingPhase = getGson().fromJson(json, VideoStatusPublishingPhase.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoStatusPublishingPhase.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoStatusPublishingPhase.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APINodeList videoStatusPublishingPhases = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoStatusUploadingPhase.java b/src/main/java/com/facebook/ads/sdk/VideoStatusUploadingPhase.java index 09e5900e..e6ae4b7c 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoStatusUploadingPhase.java +++ b/src/main/java/com/facebook/ads/sdk/VideoStatusUploadingPhase.java @@ -60,9 +60,8 @@ public String getId() { public static VideoStatusUploadingPhase loadJSON(String json, APIContext context, String header) { VideoStatusUploadingPhase videoStatusUploadingPhase = getGson().fromJson(json, VideoStatusUploadingPhase.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoStatusUploadingPhase.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoStatusUploadingPhase.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APINodeList videoStatusUploadingPhases = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoTextQuestion.java b/src/main/java/com/facebook/ads/sdk/VideoTextQuestion.java index 6bf5bbbc..82ed36fc 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoTextQuestion.java +++ b/src/main/java/com/facebook/ads/sdk/VideoTextQuestion.java @@ -119,9 +119,8 @@ public String getId() { public static VideoTextQuestion loadJSON(String json, APIContext context, String header) { VideoTextQuestion videoTextQuestion = getGson().fromJson(json, VideoTextQuestion.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoTextQuestion.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoTextQuestion.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList videoTextQuestions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoThumbnail.java b/src/main/java/com/facebook/ads/sdk/VideoThumbnail.java index 3dcfc7ae..d202f20f 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoThumbnail.java +++ b/src/main/java/com/facebook/ads/sdk/VideoThumbnail.java @@ -66,9 +66,8 @@ public String getId() { public static VideoThumbnail loadJSON(String json, APIContext context, String header) { VideoThumbnail videoThumbnail = getGson().fromJson(json, VideoThumbnail.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoThumbnail.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoThumbnail.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList videoThumbnails = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VideoUploadLimits.java b/src/main/java/com/facebook/ads/sdk/VideoUploadLimits.java index 4d1494b6..fe2903db 100644 --- a/src/main/java/com/facebook/ads/sdk/VideoUploadLimits.java +++ b/src/main/java/com/facebook/ads/sdk/VideoUploadLimits.java @@ -56,9 +56,8 @@ public String getId() { public static VideoUploadLimits loadJSON(String json, APIContext context, String header) { VideoUploadLimits videoUploadLimits = getGson().fromJson(json, VideoUploadLimits.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(videoUploadLimits.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(videoUploadLimits.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList videoUploadLimitss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/VoipInfo.java b/src/main/java/com/facebook/ads/sdk/VoipInfo.java index 61e4bc1c..68672084 100644 --- a/src/main/java/com/facebook/ads/sdk/VoipInfo.java +++ b/src/main/java/com/facebook/ads/sdk/VoipInfo.java @@ -66,9 +66,8 @@ public String getId() { public static VoipInfo loadJSON(String json, APIContext context, String header) { VoipInfo voipInfo = getGson().fromJson(json, VoipInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(voipInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(voipInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList parseResponse(String json, APIContext contex APINodeList voipInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WITUser.java b/src/main/java/com/facebook/ads/sdk/WITUser.java index f639e16d..8dbaaf58 100644 --- a/src/main/java/com/facebook/ads/sdk/WITUser.java +++ b/src/main/java/com/facebook/ads/sdk/WITUser.java @@ -58,9 +58,8 @@ public String getId() { public static WITUser loadJSON(String json, APIContext context, String header) { WITUser witUser = getGson().fromJson(json, WITUser.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(witUser.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(witUser.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContext context APINodeList witUsers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WearableDevicePublicKey.java b/src/main/java/com/facebook/ads/sdk/WearableDevicePublicKey.java index f571b6ee..d2afa49e 100644 --- a/src/main/java/com/facebook/ads/sdk/WearableDevicePublicKey.java +++ b/src/main/java/com/facebook/ads/sdk/WearableDevicePublicKey.java @@ -127,9 +127,8 @@ public String getId() { public static WearableDevicePublicKey loadJSON(String json, APIContext context, String header) { WearableDevicePublicKey wearableDevicePublicKey = getGson().fromJson(json, WearableDevicePublicKey.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(wearableDevicePublicKey.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(wearableDevicePublicKey.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -149,10 +148,9 @@ public static APINodeList parseResponse(String json, AP APINodeList wearableDevicePublicKeys = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WebAppLink.java b/src/main/java/com/facebook/ads/sdk/WebAppLink.java index 327d8942..79daaaad 100644 --- a/src/main/java/com/facebook/ads/sdk/WebAppLink.java +++ b/src/main/java/com/facebook/ads/sdk/WebAppLink.java @@ -56,9 +56,8 @@ public String getId() { public static WebAppLink loadJSON(String json, APIContext context, String header) { WebAppLink webAppLink = getGson().fromJson(json, WebAppLink.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(webAppLink.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(webAppLink.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext cont APINodeList webAppLinks = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WebPublisher.java b/src/main/java/com/facebook/ads/sdk/WebPublisher.java index 532419f7..429ebe0f 100644 --- a/src/main/java/com/facebook/ads/sdk/WebPublisher.java +++ b/src/main/java/com/facebook/ads/sdk/WebPublisher.java @@ -58,9 +58,8 @@ public String getId() { public static WebPublisher loadJSON(String json, APIContext context, String header) { WebPublisher webPublisher = getGson().fromJson(json, WebPublisher.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(webPublisher.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(webPublisher.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APIContext co APINodeList webPublishers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WebsiteCreativeAssetSource.java b/src/main/java/com/facebook/ads/sdk/WebsiteCreativeAssetSource.java index 5a98c2be..4a2504b2 100644 --- a/src/main/java/com/facebook/ads/sdk/WebsiteCreativeAssetSource.java +++ b/src/main/java/com/facebook/ads/sdk/WebsiteCreativeAssetSource.java @@ -115,9 +115,8 @@ public String getId() { public static WebsiteCreativeAssetSource loadJSON(String json, APIContext context, String header) { WebsiteCreativeAssetSource websiteCreativeAssetSource = getGson().fromJson(json, WebsiteCreativeAssetSource.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(websiteCreativeAssetSource.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(websiteCreativeAssetSource.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, APINodeList websiteCreativeAssetSources = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WebsiteCreativeAssetSuggestions.java b/src/main/java/com/facebook/ads/sdk/WebsiteCreativeAssetSuggestions.java index dc5a1ed7..36eb2fa0 100644 --- a/src/main/java/com/facebook/ads/sdk/WebsiteCreativeAssetSuggestions.java +++ b/src/main/java/com/facebook/ads/sdk/WebsiteCreativeAssetSuggestions.java @@ -119,9 +119,8 @@ public String getId() { public static WebsiteCreativeAssetSuggestions loadJSON(String json, APIContext context, String header) { WebsiteCreativeAssetSuggestions websiteCreativeAssetSuggestions = getGson().fromJson(json, WebsiteCreativeAssetSuggestions.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(websiteCreativeAssetSuggestions.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(websiteCreativeAssetSuggestions.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String APINodeList websiteCreativeAssetSuggestionss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessAccount.java b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessAccount.java index f723036d..640ee01b 100644 --- a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessAccount.java +++ b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessAccount.java @@ -155,9 +155,8 @@ public String getId() { public static WhatsAppBusinessAccount loadJSON(String json, APIContext context, String header) { WhatsAppBusinessAccount whatsAppBusinessAccount = getGson().fromJson(json, WhatsAppBusinessAccount.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(whatsAppBusinessAccount.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(whatsAppBusinessAccount.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -177,10 +176,9 @@ public static APINodeList parseResponse(String json, AP APINodeList whatsAppBusinessAccounts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessHealthStatus.java b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessHealthStatus.java index 344cf830..b8f78715 100644 --- a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessHealthStatus.java +++ b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessHealthStatus.java @@ -62,9 +62,8 @@ public String getId() { public static WhatsAppBusinessHealthStatus loadJSON(String json, APIContext context, String header) { WhatsAppBusinessHealthStatus whatsAppBusinessHealthStatus = getGson().fromJson(json, WhatsAppBusinessHealthStatus.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(whatsAppBusinessHealthStatus.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(whatsAppBusinessHealthStatus.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String jso APINodeList whatsAppBusinessHealthStatuss = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessHealthStatusForMessageSend.java b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessHealthStatusForMessageSend.java index 96c3ba46..9ebd0118 100644 --- a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessHealthStatusForMessageSend.java +++ b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessHealthStatusForMessageSend.java @@ -56,9 +56,8 @@ public String getId() { public static WhatsAppBusinessHealthStatusForMessageSend loadJSON(String json, APIContext context, String header) { WhatsAppBusinessHealthStatusForMessageSend whatsAppBusinessHealthStatusForMessageSend = getGson().fromJson(json, WhatsAppBusinessHealthStatusForMessageSend.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(whatsAppBusinessHealthStatusForMessageSend.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(whatsAppBusinessHealthStatusForMessageSend.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseRespo APINodeList whatsAppBusinessHealthStatusForMessageSends = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessPartnerClientVerificationSubmission.java b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessPartnerClientVerificationSubmission.java index 95b96312..b5450d6a 100644 --- a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessPartnerClientVerificationSubmission.java +++ b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessPartnerClientVerificationSubmission.java @@ -66,9 +66,8 @@ public String getId() { public static WhatsAppBusinessPartnerClientVerificationSubmission loadJSON(String json, APIContext context, String header) { WhatsAppBusinessPartnerClientVerificationSubmission whatsAppBusinessPartnerClientVerificationSubmission = getGson().fromJson(json, WhatsAppBusinessPartnerClientVerificationSubmission.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(whatsAppBusinessPartnerClientVerificationSubmission.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(whatsAppBusinessPartnerClientVerificationSubmission.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -88,10 +87,9 @@ public static APINodeList p APINodeList whatsAppBusinessPartnerClientVerificationSubmissions = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessPreVerifiedPhoneNumber.java b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessPreVerifiedPhoneNumber.java index 0e07d66b..884a7bc5 100644 --- a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessPreVerifiedPhoneNumber.java +++ b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessPreVerifiedPhoneNumber.java @@ -123,9 +123,8 @@ public String getId() { public static WhatsAppBusinessPreVerifiedPhoneNumber loadJSON(String json, APIContext context, String header) { WhatsAppBusinessPreVerifiedPhoneNumber whatsAppBusinessPreVerifiedPhoneNumber = getGson().fromJson(json, WhatsAppBusinessPreVerifiedPhoneNumber.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(whatsAppBusinessPreVerifiedPhoneNumber.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(whatsAppBusinessPreVerifiedPhoneNumber.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse( APINodeList whatsAppBusinessPreVerifiedPhoneNumbers = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessProfile.java b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessProfile.java index bb2ed5bd..4db5b770 100644 --- a/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessProfile.java +++ b/src/main/java/com/facebook/ads/sdk/WhatsAppBusinessProfile.java @@ -117,9 +117,8 @@ public String getId() { public static WhatsAppBusinessProfile loadJSON(String json, APIContext context, String header) { WhatsAppBusinessProfile whatsAppBusinessProfile = getGson().fromJson(json, WhatsAppBusinessProfile.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(whatsAppBusinessProfile.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(whatsAppBusinessProfile.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, AP APINodeList whatsAppBusinessProfiles = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WhatsAppPaymentCapabilities.java b/src/main/java/com/facebook/ads/sdk/WhatsAppPaymentCapabilities.java index 4344adce..441a82d6 100644 --- a/src/main/java/com/facebook/ads/sdk/WhatsAppPaymentCapabilities.java +++ b/src/main/java/com/facebook/ads/sdk/WhatsAppPaymentCapabilities.java @@ -56,9 +56,8 @@ public String getId() { public static WhatsAppPaymentCapabilities loadJSON(String json, APIContext context, String header) { WhatsAppPaymentCapabilities whatsAppPaymentCapabilities = getGson().fromJson(json, WhatsAppPaymentCapabilities.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(whatsAppPaymentCapabilities.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(whatsAppPaymentCapabilities.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json APINodeList whatsAppPaymentCapabilitiess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WhatsappSubscribedAppsInfo.java b/src/main/java/com/facebook/ads/sdk/WhatsappSubscribedAppsInfo.java index 4523252d..b1f52b61 100644 --- a/src/main/java/com/facebook/ads/sdk/WhatsappSubscribedAppsInfo.java +++ b/src/main/java/com/facebook/ads/sdk/WhatsappSubscribedAppsInfo.java @@ -56,9 +56,8 @@ public String getId() { public static WhatsappSubscribedAppsInfo loadJSON(String json, APIContext context, String header) { WhatsappSubscribedAppsInfo whatsappSubscribedAppsInfo = getGson().fromJson(json, WhatsappSubscribedAppsInfo.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(whatsappSubscribedAppsInfo.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(whatsappSubscribedAppsInfo.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APINodeList whatsappSubscribedAppsInfos = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WhitehatFBDLRun.java b/src/main/java/com/facebook/ads/sdk/WhitehatFBDLRun.java index 77c280a6..e315dfff 100644 --- a/src/main/java/com/facebook/ads/sdk/WhitehatFBDLRun.java +++ b/src/main/java/com/facebook/ads/sdk/WhitehatFBDLRun.java @@ -127,9 +127,8 @@ public String getId() { public static WhitehatFBDLRun loadJSON(String json, APIContext context, String header) { WhitehatFBDLRun whitehatFBDLRun = getGson().fromJson(json, WhitehatFBDLRun.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(whitehatFBDLRun.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(whitehatFBDLRun.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -149,10 +148,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList whitehatFBDLRuns = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WifiInformation.java b/src/main/java/com/facebook/ads/sdk/WifiInformation.java index 0dd10019..4128d3ba 100644 --- a/src/main/java/com/facebook/ads/sdk/WifiInformation.java +++ b/src/main/java/com/facebook/ads/sdk/WifiInformation.java @@ -117,9 +117,8 @@ public String getId() { public static WifiInformation loadJSON(String json, APIContext context, String header) { WifiInformation wifiInformation = getGson().fromJson(json, WifiInformation.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(wifiInformation.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(wifiInformation.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -139,10 +138,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList wifiInformations = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WindowsAppLink.java b/src/main/java/com/facebook/ads/sdk/WindowsAppLink.java index dd88ee17..2717db13 100644 --- a/src/main/java/com/facebook/ads/sdk/WindowsAppLink.java +++ b/src/main/java/com/facebook/ads/sdk/WindowsAppLink.java @@ -60,9 +60,8 @@ public String getId() { public static WindowsAppLink loadJSON(String json, APIContext context, String header) { WindowsAppLink windowsAppLink = getGson().fromJson(json, WindowsAppLink.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(windowsAppLink.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(windowsAppLink.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -82,10 +81,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList windowsAppLinks = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WindowsPhoneAppLink.java b/src/main/java/com/facebook/ads/sdk/WindowsPhoneAppLink.java index 6c245c36..9049c85c 100644 --- a/src/main/java/com/facebook/ads/sdk/WindowsPhoneAppLink.java +++ b/src/main/java/com/facebook/ads/sdk/WindowsPhoneAppLink.java @@ -58,9 +58,8 @@ public String getId() { public static WindowsPhoneAppLink loadJSON(String json, APIContext context, String header) { WindowsPhoneAppLink windowsPhoneAppLink = getGson().fromJson(json, WindowsPhoneAppLink.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(windowsPhoneAppLink.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(windowsPhoneAppLink.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -80,10 +79,9 @@ public static APINodeList parseResponse(String json, APICon APINodeList windowsPhoneAppLinks = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WithAsset3D.java b/src/main/java/com/facebook/ads/sdk/WithAsset3D.java index 1c0a8552..216b619c 100644 --- a/src/main/java/com/facebook/ads/sdk/WithAsset3D.java +++ b/src/main/java/com/facebook/ads/sdk/WithAsset3D.java @@ -113,9 +113,8 @@ public String getId() { public static WithAsset3D loadJSON(String json, APIContext context, String header) { WithAsset3D withAsset3D = getGson().fromJson(json, WithAsset3D.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(withAsset3D.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(withAsset3D.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -135,10 +134,9 @@ public static APINodeList parseResponse(String json, APIContext con APINodeList withAsset3Ds = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WoodhengePurchasedPAYGReceipt.java b/src/main/java/com/facebook/ads/sdk/WoodhengePurchasedPAYGReceipt.java index c10bb963..49475720 100644 --- a/src/main/java/com/facebook/ads/sdk/WoodhengePurchasedPAYGReceipt.java +++ b/src/main/java/com/facebook/ads/sdk/WoodhengePurchasedPAYGReceipt.java @@ -119,9 +119,8 @@ public String getId() { public static WoodhengePurchasedPAYGReceipt loadJSON(String json, APIContext context, String header) { WoodhengePurchasedPAYGReceipt woodhengePurchasedPAYGReceipt = getGson().fromJson(json, WoodhengePurchasedPAYGReceipt.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(woodhengePurchasedPAYGReceipt.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(woodhengePurchasedPAYGReceipt.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -141,10 +140,9 @@ public static APINodeList parseResponse(String js APINodeList woodhengePurchasedPAYGReceipts = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WoodhengeSupporter.java b/src/main/java/com/facebook/ads/sdk/WoodhengeSupporter.java index 8b908cee..6456d7c3 100644 --- a/src/main/java/com/facebook/ads/sdk/WoodhengeSupporter.java +++ b/src/main/java/com/facebook/ads/sdk/WoodhengeSupporter.java @@ -123,9 +123,8 @@ public String getId() { public static WoodhengeSupporter loadJSON(String json, APIContext context, String header) { WoodhengeSupporter woodhengeSupporter = getGson().fromJson(json, WoodhengeSupporter.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(woodhengeSupporter.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(woodhengeSupporter.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -145,10 +144,9 @@ public static APINodeList parseResponse(String json, APICont APINodeList woodhengeSupporters = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WorkAccessCode.java b/src/main/java/com/facebook/ads/sdk/WorkAccessCode.java index ebdeb201..9960b68d 100644 --- a/src/main/java/com/facebook/ads/sdk/WorkAccessCode.java +++ b/src/main/java/com/facebook/ads/sdk/WorkAccessCode.java @@ -56,9 +56,8 @@ public String getId() { public static WorkAccessCode loadJSON(String json, APIContext context, String header) { WorkAccessCode workAccessCode = getGson().fromJson(json, WorkAccessCode.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(workAccessCode.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(workAccessCode.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList workAccessCodes = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WorkExperience.java b/src/main/java/com/facebook/ads/sdk/WorkExperience.java index db4f7c92..1100ce02 100644 --- a/src/main/java/com/facebook/ads/sdk/WorkExperience.java +++ b/src/main/java/com/facebook/ads/sdk/WorkExperience.java @@ -131,9 +131,8 @@ public String getId() { public static WorkExperience loadJSON(String json, APIContext context, String header) { WorkExperience workExperience = getGson().fromJson(json, WorkExperience.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(workExperience.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(workExperience.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -153,10 +152,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList workExperiences = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WorkSkill.java b/src/main/java/com/facebook/ads/sdk/WorkSkill.java index 0f81d9d3..aed42eb4 100644 --- a/src/main/java/com/facebook/ads/sdk/WorkSkill.java +++ b/src/main/java/com/facebook/ads/sdk/WorkSkill.java @@ -115,9 +115,8 @@ public String getId() { public static WorkSkill loadJSON(String json, APIContext context, String header) { WorkSkill workSkill = getGson().fromJson(json, WorkSkill.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(workSkill.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(workSkill.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -137,10 +136,9 @@ public static APINodeList parseResponse(String json, APIContext conte APINodeList workSkills = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WorkUserBadges.java b/src/main/java/com/facebook/ads/sdk/WorkUserBadges.java index e9a0d90d..302546d6 100644 --- a/src/main/java/com/facebook/ads/sdk/WorkUserBadges.java +++ b/src/main/java/com/facebook/ads/sdk/WorkUserBadges.java @@ -62,9 +62,8 @@ public String getId() { public static WorkUserBadges loadJSON(String json, APIContext context, String header) { WorkUserBadges workUserBadges = getGson().fromJson(json, WorkUserBadges.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(workUserBadges.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(workUserBadges.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -84,10 +83,9 @@ public static APINodeList parseResponse(String json, APIContext APINodeList workUserBadgess = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray(); diff --git a/src/main/java/com/facebook/ads/sdk/WorkUserFrontline.java b/src/main/java/com/facebook/ads/sdk/WorkUserFrontline.java index 73711a84..18d2b718 100644 --- a/src/main/java/com/facebook/ads/sdk/WorkUserFrontline.java +++ b/src/main/java/com/facebook/ads/sdk/WorkUserFrontline.java @@ -56,9 +56,8 @@ public String getId() { public static WorkUserFrontline loadJSON(String json, APIContext context, String header) { WorkUserFrontline workUserFrontline = getGson().fromJson(json, WorkUserFrontline.class); if (context.isDebug()) { - JsonParser parser = new JsonParser(); - JsonElement o1 = parser.parse(json); - JsonElement o2 = parser.parse(workUserFrontline.toString()); + JsonElement o1 = JsonParser.parseString(json); + JsonElement o2 = JsonParser.parseString(workUserFrontline.toString()); if (o1.getAsJsonObject().get("__fb_trace_id__") != null) { o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__")); } @@ -78,10 +77,9 @@ public static APINodeList parseResponse(String json, APIConte APINodeList workUserFrontlines = new APINodeList(request, json, header); JsonArray arr; JsonObject obj; - JsonParser parser = new JsonParser(); Exception exception = null; try{ - JsonElement result = parser.parse(json); + JsonElement result = JsonParser.parseString(json); if (result.isJsonArray()) { // First, check if it's a pure JSON Array arr = result.getAsJsonArray();