Support Questions

Find answers, ask questions, and share your expertise

Extract first element of the JSON for any kind of Input JSON in Nifi

avatar
New Contributor
Extract first element of the JSON for any kind of Input JSON in Nifi.

I have a requirement to store the Input JSON and Jolt transformed output in the SQL table.

Input JSON can be anything. I can be a single element array or nested array or Object.

I dont want to store the entire JSON in the table, is there anyway we can store the first element of the JSON in the table

2 REPLIES 2

avatar
Super Guru

Hi ,

 

Can you provide examples of the different json input?

avatar
New Contributor

Input 1


"npi_code": "NEW",
"cifa_category": "XM",
"o9_category": "Accessories",
"equipment_type": "AC",
"equipment_sub_type": "CASEPROT",
"model_manf": "137181-1050",
"model_comcast": "Samsung Galaxy A51 Presidio Grip",
"memory": "",
"color": "Black",
"os": "",
"upc": 849000000000,
"sku": 849000000000,
"cifa_id": 273271,
"manufacturer_part": "137181-1050",
"description": "Speck Samsung Galaxy A51 Presidio Grip - Black",
"uom": "",
"manufacturer": "SPK",
"serialized": "N",
"equip_id_type": "ICCID",
"pre_inserted_sim": "",
"sim_type": "",
"sim_form": "",
"base_feature_tier": "",
"market_attractiveness": "",
"memory_tier": "",
"size_tier": "",
"planning_item": 848709087461,
"stat_item": "Samsung Galaxy A51 Presidio Grip",
"model_mem": "Samsung Galaxy A51 Presidio Grip",
"model_mem_color": "Samsung Galaxy A51 Presidio Grip",
"hero_status": "",
"launch_date": "2020-05-08",
"dummy_item_creation_date": "",
"npi_announcement_date": "",
"pre_order_date": "",
"ga_date": "",
"landed_at_launch_date": "",
"planned_end_of_purchase": "",
"planned_end_of_replen": "",
"planned_end_of_forecast": "",
"independence_date": "",
"disable_date": "2021-04-29",
"accessory_retail_end_of_life": ""
}

 

Input 2

{
"Item": [
{
"npi_code": "NEW",
"cifa_category": "XM",
"o9_category": "Accessories",
"equipment_type": "AC",
"equipment_sub_type": "CASEPROT",
"model_manf": "137181-1050",
"model_comcast": "Samsung Galaxy A51 Presidio Grip",
"memory": "",
"color": "Black",
"os": "",
"upc": 849000000000,
"sku": 849000000000,
"cifa_id": 273271,
"manufacturer_part": "137181-1050",
"description": "Speck Samsung Galaxy A51 Presidio Grip - Black",
"uom": "",
"manufacturer": "SPK",
"serialized": "N",
"equip_id_type": "ICCID",
"pre_inserted_sim": "",
"sim_type": "",
"sim_form": "",
"base_feature_tier": "",
"market_attractiveness": "",
"memory_tier": "",
"size_tier": "",
"planning_item": 848709087461,
"stat_item": "Samsung Galaxy A51 Presidio Grip",
"model_mem": "Samsung Galaxy A51 Presidio Grip",
"model_mem_color": "Samsung Galaxy A51 Presidio Grip",
"hero_status": "",
"launch_date": "2020-05-08",
"dummy_item_creation_date": "",
"npi_announcement_date": "",
"pre_order_date": "",
"ga_date": "",
"landed_at_launch_date": "",
"planned_end_of_purchase": "",
"planned_end_of_replen": "",
"planned_end_of_forecast": "",
"independence_date": "",
"disable_date": "2021-04-29",
"accessory_retail_end_of_life": ""
},
{
"npi_code": "NEW",
"cifa_category": "XM",
"o9_category": "Accessories",
"equipment_type": "AC",
"equipment_sub_type": "CASEPROT",
"model_manf": "137181-1050",
"model_comcast": "Samsung Galaxy A51 Presidio Grip",
"memory": "",
"color": "Black",
"os": "",
"upc": 849000000000,
"sku": 849000000000,
"cifa_id": 273271,
"manufacturer_part": "137181-1050",
"description": "Speck Samsung Galaxy A51 Presidio Grip - Black",
"uom": "",
"manufacturer": "SPK",
"serialized": "N",
"equip_id_type": "ICCID",
"pre_inserted_sim": "",
"sim_type": "",
"sim_form": "",
"base_feature_tier": "",
"market_attractiveness": "",
"memory_tier": "",
"size_tier": "",
"planning_item": 848709087461,
"stat_item": "Samsung Galaxy A51 Presidio Grip",
"model_mem": "Samsung Galaxy A51 Presidio Grip",
"model_mem_color": "Samsung Galaxy A51 Presidio Grip",
"hero_status": "",
"launch_date": "2020-05-08",
"dummy_item_creation_date": "",
"npi_announcement_date": "",
"pre_order_date": "",
"ga_date": "",
"landed_at_launch_date": "",
"planned_end_of_purchase": "",
"planned_end_of_replen": "",
"planned_end_of_forecast": "",
"independence_date": "",
"disable_date": "2021-04-29",
"accessory_retail_end_of_life": ""
}

]