AnsweredAssumed Answered

Is there a way to dynamically design a JSON profile?

Question asked by SaiKumarGoud Mallari on May 1, 2017
Latest reply on May 2, 2017 by Srinivas Chandrakanth Vangari

I have designed my JSON profile attribute (additional_information -Array Repeating) to accept Simple Value type.

Now there is change in Incoming source json response for attribute additional_information.

where the source data now has Objects inside it dynamically changing for each response.

Sample1: Has two Objects +Simple Values for additonal_information 

"additional_information": [
{--------------------------------------------------------------------------------->Object1
"md_stripe_card_id": "0:2PqBKVSzxxxxxx",
"cc_type": "",
"cc_number": "",
"expiration": "",
"expiration_yr": "",
"save_card_check": "true",
"save_card": "true"
},
"Stripe Payment By MageDelight",
{--------------------------------------------------------------------------------->Object2
"4ecaf8hjfdhufadhufdtxxxxx": {   ---------------------------------------->Here Object value name changes Dynamically
 "id": "4eca9eaf8891",
"requested_amount": 52.98,
"balance_on_card": null,
"last_trans_id": "ch_1ACvzACyE1Ks",
"processed_amount": 52.98,
"cc_type": "Visa",
"cc_owner": "Nair",
"cc_last_4": "1111",
"cc_exp_month": "9",
"cc_exp_year": "207",
"cc_ss_issue": null,
"cc_ss_start_month": null,
"cc_ss_start_year": null,
"approval_code": null,
"address_line_1_check": "",
"address_line_2_check": "",
"address_zip_check": "pass",
"cvc_check": "",
"transaction_id": "ch_1ACvsmE1Ks",
"description": "",
"method": "card",
"transaction_type": "authorization"
}
},
"card_19Dc6KCyZY1",
"cus_9BKMzudMVmY"
]

 

Sample 2 Response :Has One Object + simple Values for additional_information 

"additional_information":
[
"Stripe Payment By MageDelight",
{--------------------------------------------------------------------------------->Object 1
"7e025a7d62bggghj66a7xxxxxx": -------------------------------------->Here Object Value name changes dynamically
{
"id": "7e025a7d62b1c",
"requested_amount": 22.99,
"balance_on_card": null,
"last_trans_id": "ch_1ACvrVXQgJt",
"processed_amount": 22.99,
"cc_type": "Visa",
"cc_owner": "Kyle e",
"cc_last_4": "4242",
"cc_exp_month": "2",
"cc_exp_year": "2019",
"cc_ss_issue": null,
"cc_ss_start_month": null,
"cc_ss_start_year": null,
"approval_code": null,
"address_line_1_check": "",
"address_line_2_check": "",
"address_zip_check": "",
"cvc_check": "pass",
"transaction_id": "ch_1ACXQgJt",
"description": "",
"method": "card",
"transaction_type": "authorization"
}
},
"1",
"card_1ACvSb",
"cus_AY1vgNQdO"
]

Outcomes