import groovy.json.JsonBuilder import groovy.json.JsonSlurper def discountData = new JsonSlurper().parseText(''' { "SolutionData": { "SolutionType": "New/MACD/ Replace/Reprice", "Activity": "Save/Retrieve", "externalSolId": "4", "externalPsId": "2", "activityType": "pageload", "msPSIId": "", "discAuthLvl": "", "fmrInd": "", "promocd": "", "segment": "", "roleId": "", "strata": "", "billerId": "", "priceplanDetails": [{ "PricePlanId": "", "marc": "", "term": "", "RateLetterExpDate": "", "CoterminousIndicator": "", "BundledServiceName": "", "BundledMarcYN": "", "CoterminousExpDate": "", "isbBilled": "", "overrideYN": "", "extendedTermId": "", "pricingSourceId": "", "IcbDiscAppliedByGcsYn": "", "DiscountDetails": { "beid": "", "discountId": "", "discountRefId": "", "offer": { "offercd": "", "country": "", "regioncd": "", "ratePlanId": "", "category": "", "subcategory": "" }, "SubGroupDetails": [{ "subGroupName": "", "subGroupId": "", "userId": "", "catId": "", "subCatid": "", "sysDfnd": "", "crtdDate": "", "versionNum": "", "activeYN": "" }], "PromoDetails": [{ "promocd": "", "desc": "", "regPromoInd": "", "promoRegDataset": "", "startDate": "", "endDate": "", "crtdId": "", "crtdDate": "", "mdfdId": "", "mdfddate": "", "termDatasetName": "", "psocPromoId": "" }] }, "SOCList": { "SOCID": "", "SOCVersion": "", "productcd": "", "eRate": "", "Active": "", "effectiveDate": "", "TransactionId": "" }, "PriceScenario": [{ "PriceScenarioName": "" }] }] } }''') def getDiscountPromoRequest = new JsonBuilder() def root = getDiscountPromoRequest{ externalOfferID discountData.SolutionData.externalSolId externalPsId discountData.SolutionData.externalPsId externalDsgnId 0 activityType discountData.SolutionData.activityType pricePlanDetails discountData.SolutionData.pricePlanDetails } println(new JsonBuilder(getDiscountPromoRequest).toPrettyString())
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more