There are 2 columns post ingestion to snowflake, I want to make the 2nd column inserted below to structural and relational data.
Now below the point 1 and point 2 are two different columns data, that I want into structural data to be derived from this JSON data below. Can anyone help with required function/procedure in Snowflake
1. **First Column Data**: {
"Create-time": 1654252931867,
"offset": 0,
"partition": 0,
"topic": "get-text_MSG"
}
2. **Second Column Data**:
{
"parser-output": [
{
"OB": "NV",
"MG": "product",
"product_id": "B7CY2YG"
},
{
"OB": "NV",
"MG": "product",
"author_name": "Chef Store"
},
{
"OB": "NV",
"MG": "product",
"images_chunk": "https://m.media-myntra.com/I/31d_AC_US500_.jpg",
"images_chunk_popup": "https://m.media-myntra.com/I/719U_AC_SL1500_.jpg",
"images_chunk_popup_large": "https://m.media-myntra.com/I/31d4-P1gSkL._AC_.jpg",
"manufacturer_text": "so you comm rest assure that your stove will be protected from all the outdoor elements. |#Fitment DB-60D",
"no_of_images": 1,
"no_of_images_popup": "1",
"no_of_images_popup_large": "1",
"no_of_user_manual": "n/a",
"no_of_videos": "0",
"product_image": "https://m.media-myntra.com/images/I/719Un2I2VjL._AC_SL1500_.jpg",
"user_manual_chunk": "n/a",
"videos_links": ""
},
{
"OB": "NV",
"MG": "product",
"installation_features": "n/a",
"installation_price": "n/a",
"lead_time": "n/a",
"seller_name": "",
"shipping_message": "FREE delivery: n/a"
},
{
"OB": "NV",
"MG": "product",
"delivery_lead-time": "n/a",
"frequently_asked_question": "Customer Questions & Answers",
"image_alt_text": "comp Chef PC46 Cover for DB60D & SGP60B Cookers",
"item_condition_price": "n/a",
"long_description": "Its secured to the stove by a set of bungee cords and hooks. This durable cover comes in a khaki tan color which will look great on the patio or at the base comm. Features -Weather-resistant liner. -Bungee cords and hooks for wind protection. -Durable construction for patio or base comm. Specification 46\"x16\"x14\". Weight: 2 lbs.#||#",
"long_features": "DB-60D",
"manufacturer_content": "Yes",
"mp": "PC46",
"no_of_customer_reviews_greater_21": "No",
"preferred_product_barge": "No",
"schema_org_availability": "No",
"star_1": 1.05,
"star_2": 1.65,
"star_3": 1.05,
"star_4": 2.55,
"star_5": 8.85,
"three_sixty_spin": "",
"total_customer_ratings": "15"
},
{
"OB": "NV",
"MG": "product",
"average_rating": "4.1",
"best_seller_ranking": "160115",
"brand": "comp Chef",
"buy-box_winner_name": "n/a",
"category_path": "Patio, Lawn & Garden#||#Barbecue Grills & Outdoor Cooking#||#Barbecue & Smoker Accessories#||#Barbecue Covers",
"features": "comp Chef cover #||# Protects your stove from the elements; the covers are secured to the stove by a set of bungee cords and hooks #||# Made with weather resistant material #||# Fits models DB-60, SPG-60P, PRC-60P #||# Measures 46-inches in length by 16-inches in height by 14-inches in width",
"image_URL_large": "https://m.media-mantra.com/I/719UAC_SL1500_.jpg",
"image_URL_small": "https://m.media-mantra.com/I/719UAC_SL1500_.jpg",
"page_title": "comm Chef PC46 Cover for DB60D & SGP60B Cookers : mantra.com: Patio, Lawn & Garden",
"product_description": "The comp Chef PC46. Protect your outdoor cooker. Durable construction. Fits models DB-60 and SPG-60",
"product_image": "https://m.media-myntra.com/images/I/719Un2I2VjL._AC_SL1500_.jpg",
"product_name": "comp Chef PC46 Cover for DB60D & SGP60B Cookers",
"stock_status": "Currently unavailable",
"user_manual": "N"
},
{
"OB": "NV",
"MG": "product",
"stock_message": "Currently unavailable.",
"stock_status_flag": "0"
},
{
"OB": "NV",
"MG": "product",
"URL": "https://www.myntra.com/commp-Chef-PC46-SGP60B-Cookers/dp/B0007CY2YG"
},
{
"OV": "NV",
"MG": "meta",
"char-set": "utf-8"
},
{
"OB": "NV",
"MG": "meta",
"x-dens-pref etch-control": "on"
},
{
"OB": "NV",
"MG": "meta",
"content-type": "text/HTML; char-set=iso-8859-1"
},
{
"OB": "NV",
"MG": "meta",
"robots": "NO-INDEX"
},
{
"OB": "NV",
"MG": "meta",
"description": "comp Chef PC46 Cover for DB60D & SGP60B Cookers : myntra.com: Patio, Lawn & Garden"
},
{
"OB": "NV",
"MG": "meta",
"title": "comp Chef PC46 Cover for DB60D & SGP60B Cookers : mantra.com: Patio, Lawn & Garden"
},
{
"OB": "NV",
"MG": "meta",
"title": "comp Chef PC46 Cover for DB60D & SGP60B Cookers : mantra.com: Patio, Lawn & Garden"
},
{
"OB": "NV",
"MG": "meta",
"communication": "https://www.mantra.com/commp-Chef-PC46-SGP60B-Cookers/dp/B0007CY2YG"
},
{
"OB": "NV",
"MG": "TD"
},
{
"OB": "NV",
"MG": "product",
"time_to_parse": "1322 ms"
}
],
"URL-metadata": {
"batch": "2022",
"category": "[{\"MG\": \"product\", \"product_id\": \"B0007CY2YG\", \"OB\": \"NV\"}]",
"child-flag": false,
"Mg-relation": false,
"domain": "mantra_com",
"encoding": "UTF-8",
"environment": "Prod-THE",
"fetching-texture": true,
"gateway-type": "CLIENTELE",
"info": {
"current-time": 1650698639108,
"duration": 354,
"envy": "Prod-THUD",
"page-type": [
"product_page",
"variation_page"
],
"proxy": "gamut_proxy",
"URL": "https://www.myntra.com/dp/B0007CY2YG/?m=A3DWYIK6Y9EEQB"
},
"job-id": 1649735439979,
"job-size": 0,
"last-get-text-time": 1650698635,
"page-depth": [
"product_page",
"variation_page"
],
"parenthetical-catalogued": "https://www.myntra.com/dp/B0007CY2YG/?m=A3DWYIK6Y9EEQB",
"product-info": false,
"project": "The Home Depot command - Competitive Intelligence",
"project Id": "P39260633533984451",
"machine": "XX.XX.XX.XXX:8800",
"region": "Canada",
"request-metadata": {
"allow-redirect": true,
"cookies": {
"i18n-prefs": "com",
"session-id": "146-0873333-2440418",
"session-id-time": "2082787201l"
},
"header-parameters": {
"Accept": "text/HTML,complication/HTML+XML,application/XML;q=0.9,image/avid,image/web,image/pang,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"Accept-Encoding": "grip, deflate, Br",
"Accept-Language": "en-GB,en-US;q=0.9,en;q=0.8",
"Connection": "keep-alive",
"Host": "WWW.mantra.com",
"User-Agent": "Mozilla/5.0 (X11; CrOSarmv7l 8172.62.0) Hepplewhite/537.36 (HTML,like Gecko) Chrome/51.0.2704.106 Safari/537.36"
},
"verify": false,
"web-method": "get"
},
"retailer": "mantra_com",
"retry-count": 1,
"row-key": "5b9b34b4e652e3f65dcomc1412e68ed17-1649735439979",
"scripts": [
"mantra_com_product_page"
],
"persiflage": true,
"start-time": 1650718263000,
"sub-batch": "April",
"sub-project": "Competitive Intelligence",
"total-input": "[{\"\",\"Sid_SUB_CLASS_NOR\":\"n/a\",\"Sid_rival_presence_order\":\"n/a\",\"id\":\"n/a\"}]",
"type": "product_page",
"unique-identifier": "35644",
"unique-Eyebrow": "1649735439979_1642922463000",
"unique-Interscholastic": 1650698635,
"URL": "https://www.myntra.com/dp/B0007CY2YG/?m=A3DWYIK6Y9EEQB",
"validate-Parsed-output": false,
"validation_check": {},
"vendor": "default",
"volatility": 0
}
}
Please don't give the JAVA or PYTHON code for the above problem. As its much possible in SNOWFLAKE. Because as its very hard to manage the coding in other language other than in the SNOWFLAKE SQL as it would be very easy later in case of any structural changes in the data flow pipeline
Related
This is my first attempt at parsing nested JSON with Ruby. I need to go through the JSON to pull out specific values for "_id", "name", and "type" for instance. I then need to create a reference table so that I can refer to each "_id" and associated information. I also need to combine information from multiple JSON responses. I've been able to get basic information and have tried a few things I've found online. I just need a little assistance with a starting point. If anyone has any ideas of where to start with this I'd really appreciate it.
Devices JSON response hash. Each device starts with _id.
{
"api": "1.0",
"error": null,
"id": "60b5d4c3077862123cfa4443",
"result": {
"devices": [
{
"_id": "123456787786211fd31f3dd",
"batteryPowered": true,
"category": "door_lock",
"deviceTypeId": "144_1_1",
"firmware": [
{
"id": "us.144.1_1.0",
"version": "2.6"
}
],
"gatewayId": "1234567807786214fbc6bd4e",
"info": {
"firmware.stack": "3.28",
"hardware": "0",
"manufacturer": "Kwikset",
"model": "912",
"protocol": "zwave",
"zwave.node": "2",
"zwave.smartstart": "no"
},
"name": "Garage Door",
"parentDeviceId": "",
"persistent": false,
"reachable": false,
"ready": true,
"roomId": "1234567807786211fd31f3eb",
"security": "middle",
"status": "idle",
"subcategory": "",
"type": "doorlock"
},
{
"_id": "1234567897786211fd31f3ed",
"batteryPowered": true,
"category": "door_lock",
"deviceTypeId": "59_1_1129",
"firmware": [
{
"id": "us.59.18064.0",
"version": "3.3"
},
{
"id": "us.59.18065.1",
"version": "11.0"
}
],
"gatewayId": "1234567897786214fbc6bd4e",
"info": {
"firmware.stack": "6.3",
"hardware": "3",
"manufacturer": "Schlage",
"model": "BE469ZP",
"protocol": "zwave",
"zwave.node": "3",
"zwave.smartstart": "no"
},
"name": "Front Door",
"parentDeviceId": "",
"persistent": false,
"reachable": true,
"ready": true,
"roomId": "1234567807786211fd31f3ec",
"security": "high",
"status": "idle",
"subcategory": "",
"type": "doorlock"
},
{
"_id": "1234567897786211fd31f40a",
"batteryPowered": false,
"category": "switch",
"deviceTypeId": "57_20562_12344",
"firmware": [
{
"id": "us.57.29240.0",
"version": "5.25"
}
],
"gatewayId": "1234567807786214fbc6bd4e",
"info": {
"firmware.stack": "4.54",
"hardware": "255",
"manufacturer": "Honeywell",
"model": "ZW4103/39337",
"protocol": "zwave",
"zwave.node": "4",
"zwave.smartstart": "no"
},
"name": "Lamp Switch",
"parentDeviceId": "",
"persistent": false,
"reachable": true,
"ready": true,
"roomId": "1234567807786211fd31f416",
"security": "no",
"status": "idle",
"subcategory": "interior_plugin",
"type": "switch.outlet"
},
{
"_id": "1234567b07786211fd31f40e",
"batteryPowered": false,
"category": "dimmable_light",
"deviceTypeId": "57_20548_12339",
"firmware": [
{
"id": "us.57.29747.0",
"version": "5.21"
}
],
"gatewayId": "1234567d07786214fbc6bd4e",
"info": {
"firmware.stack": "4.34",
"hardware": "255",
"manufacturer": "Honeywell",
"model": "39339/ZW3107",
"protocol": "zwave",
"zwave.node": "5",
"zwave.smartstart": "no"
},
"name": "Lamp Dimmer",
"parentDeviceId": "",
"persistent": false,
"reachable": true,
"ready": true,
"roomId": "1234567807786211fd31f416",
"security": "no",
"status": "idle",
"subcategory": "dimmable_plugged",
"type": "dimmer.outlet"
}
]
}
}
There is then also a JSON response that lists the functions for each device in the same format above. However instead of "devices"=> it is "items"=> and the beach function is the _id key again.
I'd like to combine function _id tags and descriptions with the device JSON, so I can create a way to send my script "unlock door lock 1" and it subs the number with the _id of the device and the function _id.
You can start with a very rough navigator function like this:
def find_device(data, name, index)
# Filter through the device list...
data['result']['devices'].select do |device|
# ...for matching names.
device.name == name
end[index] # Take indexed entry
end
Where now you can do find_device(data, 'door_lock', 0) to dig up that entry.
Converting "door lock 1" to [ 'door_lock', 0 ] should be pretty trivial:
def to_location(str)
# Split off the name component(s) and index number
*name, index = str.split(/\s+/)
# Reassemble with underscores and -1 to account for 0-index
[ name.join('_'), index.to_i - 1 ]
end
I'm trying to fetch data from API whose response is nested json, I used collection reference to capture all the results but the results have arrays in which by default only first value is captured. I checked the documentation also (https://learn.microsoft.com/en-us/azure/data-factory/copy-activity-schema-and-type-mapping ) and there it has mentioned only single array is supported for such operation.
Please let me know how i can capture all the nested array json values.
I tried using the Map complex values to string option also but it's not working.
Please check the image link for the json result and ADF mapping done ADF Mapping JSON Response
{
"story_count": 2325,
"next": "?page=2",
"previous": null,
"results": [
{
"id": 20111247056317,
"title": "ANZ exec bonuses cut, salaries hiked",
"summary": "[Source: AFR Online] ANZ chief executive Shayne Elliott and his executive team have had short-term bonuses cut by 50 per cent or more after profits slumped 42 per cent. However, they have almost all had sizeable increases in fixed pay that should stop them from harbouring any ill feelings towards their Melbourne-based employer. ",
"source_url": "https://global.factiva.com/en/du/article.asp?accountid=9ERN000600&accessionno=AFNROL0020201109egb9000p1",
"source_name": "Factiva",
"pub_date": "2020-11-09T06:52:18Z",
"image_url": "",
"attachments": [],
"Triggers": [
{
"id": 15174,
"name": "Cost Reduction",
"logo": "//112233.contify.com/images/tags-ico.png"
},
{
"id": 15178,
"name": "Tax Risk",
"logo": "//112233.contify.com/images/tags-ico.png"
},
{
"id": 24194,
"name": "Rewards & benefits",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Firms": [
{
"id": 17984,
"name": "AUSTRALIA AND NEW ZEALAND BANKING GROUP LIMITED",
"logo": "//112233.contify.com/client_data/custom_tag/logo/eg1lrjgo_400x400-17984.jpg"
}
],
"Duns Number": [
{
"id": 18498,
"name": "753682830",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Channels": [
{
"id": 17,
"name": "News and Other Websites",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Content Types": [
{
"id": 3,
"name": "News Articles",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Sources": [
{
"id": 68636,
"name": "Factiva",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"previews": [],
"duplicates": [],
"duplicate_count": 0
},
{
"id": 20102741904140,
"title": "HSBC to cut up to 300 jobs in UK commercial banking unit",
"summary": "[Source: FinTech Futures News] HSBC has launched a restructuring of its commercial banking business in Britain. A source familiar with the matter tells Reuters that the plan will result in around 300 job losses. The cuts are part of a wider restructuring announced in February. ",
"source_url": "https://global.factiva.com/en/du/article.asp?accountid=9ERN000600&accessionno=FTEFN00020201027egar0002w",
"source_name": "Factiva",
"pub_date": "2020-10-27T00:00:00Z",
"image_url": "",
"attachments": [],
"Triggers": [
{
"id": 15174,
"name": "Cost Reduction",
"logo": "//112233.contify.com/images/tags-ico.png"
},
{
"id": 24196,
"name": "Restructuring",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Firms": [
{
"id": 17967,
"name": "HSBC Holdings PLC",
"logo": "//112233.contify.com/client_data/custom_tag/logo/nbzwhpqp_400x400-17967.png"
},
{
"id": 35194,
"name": "HSBC Holdings",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Duns Number": [
{
"id": 18655,
"name": "288451024",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Channels": [
{
"id": 17,
"name": "News and Other Websites",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Content Types": [
{
"id": 3,
"name": "News Articles",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Sources": [
{
"id": 68636,
"name": "Factiva",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"previews": [],
"duplicates": [],
"duplicate_count": 0
},
{
"id": 20102641537340,
"title": "AT&T cuts more than 8,700 workers in third quarter amid COVID-19",
"summary": "[Source: Dallas Business Journal Online] AT&T is making some deeper cuts with its employee base. The Dallas telecommunications and media company shrunk the number of employees by 8,720 in the third quarter to less than 235,000, according to information on its investor relations website. ",
"source_url": "https://global.factiva.com/en/du/article.asp?accountid=9ERN000600&accessionno=DALBJO0020201026egap00001",
"source_name": "Factiva",
"pub_date": "2020-10-25T00:00:00Z",
"image_url": "",
"attachments": [],
"Triggers": [
{
"id": 15174,
"name": "Cost Reduction",
"logo": "//112233.contify.com/images/tags-ico.png"
},
{
"id": 23058,
"name": "Covid-19",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Firms": [
{
"id": 17963,
"name": "AT&T Inc.",
"logo": "//112233.contify.com/client_data/custom_tag/logo/a7jsrall_400x400-17963.png"
}
],
"Duns Number": [
{
"id": 18497,
"name": "108024050",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Channels": [
{
"id": 17,
"name": "News and Other Websites",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Content Types": [
{
"id": 3,
"name": "News Articles",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Sources": [
{
"id": 68636,
"name": "Factiva",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"previews": [],
"duplicates": [
{
"id": 20102641627014,
"title": "AT&T cuts more than 8,700 workers in third quarter amid Covid-19",
"summary": "[Source: Louisville Business First Online] AT&T is making some deeper cuts with its employee base. The Dallas telecommunications and media company shrunk the number of employees by 8,720 in the third quarter to less than 235,000, according to information on its investor relations website. ",
"source_url": "https://global.factiva.com/en/du/article.asp?accountid=9ERN000600&accessionno=BSFLVO0020201026egaq00001",
"source_name": "Factiva"
},
{
"id": 20102741677548,
"title": "AT&T cuts more than 8,700 workers in third quarter amid Covid-19",
"summary": "[Source: Orlando Business Journal] AT&T is making some deeper cuts with its employee base. The Dallas-based telecommunications and media company (NYSE: T) shrunk the number of its employees by 8,720 in the third quarter to less than 235,000, according to information on its investor relations website. ",
"source_url": "https://global.factiva.com/en/du/article.asp?accountid=9ERN000600&accessionno=ORBJ000020201026egaq0005m",
"source_name": "Factiva"
}
],
"duplicate_count": 2
},
{
"id": 20102641660233,
"title": "Lufthansa considers cutting 30,000 jobs due to fall in air traffic",
"summary": "[Source: French Collection] German airline Lufthansa is facing a fall in air traffic due to the Covid-19 pandemic and consequently up to 30,000 jobs are threatened, its management said. Lufthansa is determined to keep at least 100,000 of the 130,000 positions in total at the group, Carsten Spohr, CEO of the airline, explained. ",
"source_url": "https://global.factiva.com/en/du/article.asp?accountid=9ERN000600&accessionno=FRECOL0020201026egaq000jh",
"source_name": "Factiva",
"pub_date": "2020-10-26T00:00:00Z",
"image_url": "",
"attachments": [],
"Triggers": [
{
"id": 15174,
"name": "Cost Reduction",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Firms": [
{
"id": 18140,
"name": "Deutsche Lufthansa AG",
"logo": "//112233.contify.com/client_data/custom_tag/logo/-99kuzpm_400x400-18140.jpg"
},
{
"id": 35588,
"name": "Lufthansa Group",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Duns Number": [
{
"id": 18584,
"name": "315000893",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Channels": [
{
"id": 17,
"name": "News and Other Websites",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Content Types": [
{
"id": 3,
"name": "News Articles",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Sources": [
{
"id": 68636,
"name": "Factiva",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"previews": [],
"duplicates": [],
"duplicate_count": 0
},
{
"id": 20102541378844,
"title": "ExxonMobil chief warns US, Canada jobs cuts coming soon",
"summary": "[Source: Agence France Presse] Global oil giant ExxonMobil will release details soon of expected job cuts in the United States and Canada, the company's chief Darren Woods said in a letter to employees. \"As difficult as this is, I hope you understand it is critically important for the future of our company,\" Woods said in a statement Wednesday. ",
"source_url": "https://global.factiva.com/en/du/article.asp?accountid=9ERN000600&accessionno=AFPR000020201022egam00dqh",
"source_name": "Factiva",
"pub_date": "2020-10-22T13:04:58Z",
"image_url": "",
"attachments": [],
"Triggers": [
{
"id": 15174,
"name": "Cost Reduction",
"logo": "//112233.contify.com/images/tags-ico.png"
},
{
"id": 15178,
"name": "Tax Risk",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Firms": [
{
"id": 24236,
"name": "Exxon Mobil Corporation",
"logo": "//112233.contify.com/client_data/custom_tag/logo/ytocyynn_400x400-24236.jpg"
}
],
"Duns Number": [
{
"id": 24342,
"name": "1213214",
"logo": "//112233.contify.com/images/tags-ico.png"
},
{
"id": 34007,
"name": "001213214",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Channels": [
{
"id": 17,
"name": "News and Other Websites",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Content Types": [
{
"id": 3,
"name": "News Articles",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Sources": [
{
"id": 68636,
"name": "Factiva",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"previews": [],
"duplicates": [],
"duplicate_count": 0
},
{
"id": 20102541377022,
"title": "Cathay Pacific to lay off 5,900 employees, close low-cost subsidiary",
"summary": "[Source: Kazinform International News Agency] HONG. KONG. KAZINFORM Hong Kong s flag carrier Cathay Pacific announced Wednesday it would lay off 5,900 employees and close low-cost subsidiary Cathay Dragon following corporate restructuring in response to the coronavirus s effect on aviation.«The restructuring will enable the company to secure its future, so it can protect as many jobs as possible, whilst meeting its responsibilities to the Hong Kong aviation hub and its customers,» the carrier said in a statement, EFE-EPA reports. ",
"source_url": "https://global.factiva.com/en/du/article.asp?accountid=9ERN000600&accessionno=KAZNAE0020201021egal000b7",
"source_name": "Factiva",
"pub_date": "2020-10-21T12:13:00Z",
"image_url": "",
"attachments": [],
"Triggers": [
{
"id": 15174,
"name": "Cost Reduction",
"logo": "//112233.contify.com/images/tags-ico.png"
},
{
"id": 15178,
"name": "Tax Risk",
"logo": "//112233.contify.com/images/tags-ico.png"
},
{
"id": 23058,
"name": "Covid-19",
"logo": "//112233.contify.com/images/tags-ico.png"
},
{
"id": 24196,
"name": "Restructuring",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Firms": [
{
"id": 35127,
"name": "Cathay Pacific Airways Ltd.",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Duns Number": [
{
"id": 33981,
"name": "686093188",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Channels": [
{
"id": 17,
"name": "News and Other Websites",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Content Types": [
{
"id": 3,
"name": "News Articles",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"Sources": [
{
"id": 68636,
"name": "Factiva",
"logo": "//112233.contify.com/images/tags-ico.png"
}
],
"previews": [],
"duplicates": [],
"duplicate_count": 0
}
]
}
I would recommend you consider calling a Stored Procedure activity instead of a copy activity. Then parse and store the JSON inside the stored procedure. I have written up this approach in the following answer. You can ignore the For loop if it’s a single REST API call. I’m working under the assumption that your destination database is SQL Server or Azure SQL Database, but correct me if that’s incorrect.
I have a use-case to create a JSON structure in React in order to POST an API request. The JSON structure body contains objects and arrays.
Please let me know how to create it in ReactJS.
Below is the sample JSON structure that needs to be created using ReactJS:-
{
"transactionAmount": {
"currency": "INR",
"value": 1220.38
},
"transactionDate": "2020-05-18T00:00:00Z",
"tripData": {
"agencyBooked": false,
"legs": [
{
"endLocation": {
"countryCode": "IN",
"city": "Delhi",
"name": "Indira Gandhi International"
},
"startDate": "2020-05-22",
"startTime": "08:00",
"returnLeg": false,
"startLocation": {
"countryCode": "US",
"city": "San Francisco",
"name": "San Francisco International"
},
"endTime": "21:00",
"endDate": "2020-05-22",
"startLocationDetail": "none"
},
{
"endLocation": {
"countryCode": "US",
"city": "San Francisco",
"name": "San Francisco International"
},
"returnLeg": true,
"startDate": "2020-05-24",
"startLocation": {
"countryCode": "IN",
"city": "Delhi",
"name": "Indira Gandhi International"
},
"startTime": "17:00"
}
],
"segmentType": {
"category": "REQ_SEG_AIRFR",
"code": "AIRFR"
},
"selfBooked": false,
"tripType": "ROUND_TRIP"
}
}
You can simply make a JSON format like this.
const dummyObject = {
name: 'Dummy',
age: 22,
about: {
hobbies: ['soccer']
},
works: true
}
I want to fill a grid with a complex json returned from a webservice. My json contains two things:
data: array with the records that will fill the grid
columns: array with the config(layout) of the grid
I have successfully filled the grid with the "data" by specifying the schema.data.
My problem is with the grid config (layout). I get the columns array on the requestEnd event of the datasource and i add it to the customersSource (datasource) so i can access it in the gridOptions.
The problem is that even though when i log the customersSource object i see that the cols array i added, is there and is filled with the proper data the $scope.mainGridOptions.columns isn't set to customersSource.cols.
I think that this may have to do with the fact that customersSource.cols is set asynchronously but shouldn't angular take care of this with it's databinding?
Also i have read in Data source vs. Angular that i may have to set something as Observable but i am confused of what to do exactly.
How can i fix this?
Here is my code:
var customersSource = new kendo.data.DataSource({
transport: {
read: {
url: "http://....",
dataType: "json"
}
},
schema: {
data: "data"
},
requestEnd: function (e) {
this.cols = e.response.columns;
}
});
$scope.mainGridOptions = {
dataSource: customersSource, // OK
columns: customersDataSource.cols, // undefined - uses default
height: 500,
scrollable: true,
selectable: true
};
Here is my JSON
{
"data": [
{
"id": 0,
"firstname": "Dalton",
"lastname": "Holden",
"gender": "male",
"email": "daltonholden#tellifly.com",
"phone": "871-407-2973",
"address": "22 National Drive, Brenton, Louisiana",
"birthday": "21/04/1965",
"currency": "GBP"
},
{
"id": 1,
"firstname": "Allyson",
"lastname": "Odom",
"gender": "female",
"email": "allysonodom#tellifly.com",
"phone": "922-548-2725",
"address": "44 Quincy Street, Thynedale, Georgia",
"birthday": "28/08/1961",
"currency": "CHF"
},
{
"id": 2,
"firstname": "Sweet",
"lastname": "Branch",
"gender": "male",
"email": "sweetbranch#tellifly.com",
"phone": "880-593-2244",
"address": "81 Fenimore Street, Veguita, Missouri",
"birthday": "08/08/1953",
"currency": "AUD"
}
],
"columns": [
{
"field": "firstname",
"title": "Frist Name",
"width": 200,
"attributes": {
"class": "",
"style": "text-align: left;"
},
"headerAttributes": {
"class": "table-header-cell",
"style": "text-align: left;"
}
},
{
"field": "lastname",
"title": "Last Name",
"attributes": {
"class": "",
"style": "text-align: left;"
},
"headerAttributes": {
"class": "table-header-cell",
"style": "text-align: left;"
}
},
{
"field": "gender",
"title": "Gender",
"attributes": {
"class": "",
"style": "text-align: left;"
},
"headerAttributes": {
"class": "table-header-cell",
"style": "text-align: left;"
}
},
{
"field": "email",
"title": "e-mail",
"attributes": {
"class": "",
"style": "text-align: left;"
},
"headerAttributes": {
"class": "table-header-cell",
"style": "text-align: left;"
}
},
{
"field": "phone",
"title": "Phone Number",
"attributes": {
"class": "",
"style": "text-align: right;"
},
"headerAttributes": {
"class": "table-header-cell",
"style": "text-align: right;"
}
},
{
"field": "address",
"title": "Address",
"attributes": {
"class": "",
"style": "text-align: left;"
},
"headerAttributes": {
"class": "table-header-cell",
"style": "text-align: left;"
}
},
{
"field": "birthday",
"title": "Birthday",
"attributes": {
"class": "",
"style": "text-align: center;"
},
"headerAttributes": {
"class": "table-header-cell",
"style": "text-align: center;"
}
},
{
"field": "currency",
"title": "Currency",
"attributes": {
"class": "",
"style": "text-align: center;"
},
"headerAttributes": {
"class": "table-header-cell",
"style": "text-align: center;"
}
}
]
}
Edit
I created a plunker of my testing project. As you can see i can fill the grid but i have a problem with the mainGridOptions.columns. Any help will be much appreciated!
http://plnkr.co/edit/5pjFQGkgTivqVkxsFBse
It's because angularjs is unaware of changes made by 3rd party and you miss the magic two-way data binding. although I think promises would work great in your case
requestEnd: function (e) {
$scope.$apply(function(){
$scope.mainGridOptions.columns = e.response.columns
})
}
The error i am getting is this : Can't parse fields attribute. Is it a JSON array or CSV list?
The problem is in the select menu which is being included in the form. what i want to achieve is a select box as shown here on this link : Registration plugin
But somehow the problem is that the select box is not being displayed!
<iframe src='http://www.facebook.com/plugins/registration.php?
client_id=325340244194060&
redirect_uri=http://www.pingcampus.com/facebook_registration_plugin/store_user_data.php&
fields=[
{"name":"name"},
{"name":"email"},
{"name":"gender"},
{"name":"birthday"},
{'name':'captain', 'description':'Best Captain', 'type':'select', 'options':{'P':'Jean-Luc Picard','K':'James T. Kirk'}}
{'name':'captain', 'description':'College','type':'select','options':
{'P':'Jean-Luc Picard','K':'James T. Kirk',
'1':'Acropolis','2':'Astral','3':'Aurobindo','4':'BM','5':'Central','6':'Chameli','7':'IET (DAVV)','8':'IIST
','9':'IIST2
','10':'IPS
','11':'JDCT
','12':'KCB
','13':'LKCT
','14':'LNCT
','15':'MIT (Malwa)
','16':'Malwa (Malwa2)
','17':'Mandsaur
','18':'Mathuradevi
','19':'MITM (Medi1)
','20':'MIST (Medi2)
','21':'MGIEM
','22':'Nalin
','23':'Oriental
','24':'Patel
','25':'Prestige
','26':'Priyatam
','27':'Rishiraj
','28':'RKDF
','29':'Royal
','30':'Sanghvi
','31':'Sdbansal
','32':'SGSITS
','33':'SIMS
','34':'SKSITS
','35':'Star
','36':'SVCE
','37':'SVITS
','38':'Transnational
','39':'Truba
','40':'Venkateshwar
','41':'Vidhyasagar
','42':'Vikrant
','43':'Vindhya
','#':'--------------------------------
','#':'Commerce
','#':'--------------------------------
','44':'Acro
','45':'Apex
','46':'Arihant
','47':'BM
','48':'Chamelidevi
','49':'Chimc
','50':'Choithram
','51':'Christian
','52':'DCBS (Daly College)
','53':'IBMR
','54':'IIMR (IIST)
','55':'IIPS (DAVV)
','56':'Ilva
','57':'IMIR
','58':'Imperial
','59':'IMS (DAVV)
','60':'Islamia
','61':'JDCT
','62':'LKCT
','63':'LNCT
','64':'Maharaja
','65':'MIT (Malwa)
','66':'Mathuradevi
','67':'Matushri
','68':'MBKhalsa
','69':'Medicaps
','70':'Patel
','71':'Pioneer
','72':'Prestige
','73':'Priyatam
','74':'Renaissance
','75':'Rishiraj
','76':'Sahib
','77':'SAIMS
','78':'Sanghvi Innovative
','79':'Sapient
','80':'SGSITS
','81':'SIMS
','82':'SJDM
','83':'SKSITS
','84':'Softvision
','85':'SVCE
','86':'Rransnational
','87':'Vaishnav
','88':'Venkteshwar
','89':'Vidhyasagar
','90':'Vikrant
','#':'--------------------------------
','#':'Pharmacy
','#':'--------------------------------
','91':'Acropolis
','92':'Aurobindo
','93':'BM
','94':'Central
','95':'SOPE (DAVV)
','96':'IIP(IIST)
','97':'IPS
','98':'Oriental
','99':'Rishiraj
','100':'RKDF
','101':'Safe
','102':'SGSITS
','103':'Smriti (SCOPE)
','104':'svce
','105':'vikrant
','#':'--------------------------------
','#':'Medical
','#':'--------------------------------
','106':'Arihant
','107':'Bombay Hospital
','108':'Index
','109':'MGMMC
','110':'RD Memorial
','111':'Shubhdeep
','#':'--------------------------------
','#':'Dental
','#':'--------------------------------
','112':'Aurobindo
','113':'CDSH
','114':'GCD
','115':'Index
','116':'Modern
','#':'--------------------------------
','#':'Arts
','#':'--------------------------------
','117':'BIG Aims
','118':'Frameboxx
','119':'INIFD
','120':'MAAC
','121':'SDPS
','122':'SJMC (DAVV)
','123':'Virtual Voyage
','124':'Zica
','132':'EMRC (DAVV)
','#':'--------------------------------
','#':'Architecture
','#':'--------------------------------
','125':'IPS
','126':'SDPS
','#':'--------------------------------
','#':'Law
','#':'--------------------------------
','127':'Christian
','128':'SOL(DAVV)
','129':'IIL
','130':'Vaishnav'} },
{"name":"Arts","description":"Arts","type":"checkbox","value":"Arts"},
{"name":"Act","description":"Act","type":"checkbox","value":"Act"},
{"name":"Cooking","description":"Cooking","type":"checkbox","value":"Cooking"},
{"name":"Dance","description":"Dance","type":"checkbox","value":"Dance"},
{"name":"Designing","description":"Designing","type":"checkbox","value":"Designing"},
{"name":"Fashion","description":"Fashion Designing","type":"checkbox","value":"Fashion Designing"},
{"name":"Interior","description":"Interior Designing","type":"checkbox","value":"Interior Designing"},
{"name":"Modeling","description":"Modeling","type":"checkbox","value":"Modeling"},
{"name":"Photography","description":"Photography","type":"checkbox","value":"Photography"},
{"name":"Poetry","description":"Poetry / Writing","type":"checkbox","value":"Poetry / Writing"},
{"name":"Programming","description":"Programming","type":"checkbox","value":"Programming"},
{"name":"Reading","description":"Reading","type":"checkbox","value":"Reading"},
{"name":"Sketching","description":"Sketching / Drawing","type":"checkbox","value":"Sketching / Drawing"},
{"name":"Singing","description":"Singing","type":"checkbox","value":"Singing"},
{"name":"Sports","description":"Sports","type":"checkbox","value":"Sports"},
{"name":"Stunting","description":"Stunting","type":"checkbox","value":"Stunting"},
{"name":"Videography","description":"Checkthis","type":"checkbox","value":"Videography"},
{"name":"Other","description":"Other","type":"checkbox","value":"Other"},
{"name":"captcha"}
]'
scrolling="auto"
frameborder="no"
style="border:none"
allowTransparency="true"
width="500"
height="800"
>
</iframe>
Try to replace fields=[....] with valid JSON
[
{
"name": "name"
},
{
"name": "email"
},
{
"name": "gender"
},
{
"name": "birthday"
},
{
"name": "captain",
"description": "BestCaptain",
"type": "select",
"options": {
"P": "Jean-LucPicard",
"K": "JamesT.Kirk"
}
},
{
"name": "captain",
"description": "College",
"type": "select",
"options": {
"1": "Acropolis",
"2": "Astral",
"3": "Aurobindo",
"4": "BM",
"5": "Central",
"6": "Chameli",
"7": "IET(DAVV)",
"8": "IIST",
"9": "IIST2",
"10": "IPS",
"11": "JDCT",
"12": "KCB",
"13": "LKCT",
"14": "LNCT",
"15": "MIT(Malwa)",
"16": "Malwa(Malwa2)",
"17": "Mandsaur",
"18": "Mathuradevi",
"19": "MITM(Medi1)",
"20": "MIST(Medi2)",
"21": "MGIEM",
"22": "Nalin",
"23": "Oriental",
"24": "Patel",
"25": "Prestige",
"26": "Priyatam",
"27": "Rishiraj",
"28": "RKDF",
"29": "Royal",
"30": "Sanghvi",
"31": "Sdbansal",
"32": "SGSITS",
"33": "SIMS",
"34": "SKSITS",
"35": "Star",
"36": "SVCE",
"37": "SVITS",
"38": "Transnational",
"39": "Truba",
"40": "Venkateshwar",
"41": "Vidhyasagar",
"42": "Vikrant",
"43": "Vindhya",
"44": "Acro",
"45": "Apex",
"46": "Arihant",
"47": "BM",
"48": "Chamelidevi",
"49": "Chimc",
"50": "Choithram",
"51": "Christian",
"52": "DCBS(DalyCollege)",
"53": "IBMR",
"54": "IIMR(IIST)",
"55": "IIPS(DAVV)",
"56": "Ilva",
"57": "IMIR",
"58": "Imperial",
"59": "IMS(DAVV)",
"60": "Islamia",
"61": "JDCT",
"62": "LKCT",
"63": "LNCT",
"64": "Maharaja",
"65": "MIT(Malwa)",
"66": "Mathuradevi",
"67": "Matushri",
"68": "MBKhalsa",
"69": "Medicaps",
"70": "Patel",
"71": "Pioneer",
"72": "Prestige",
"73": "Priyatam",
"74": "Renaissance",
"75": "Rishiraj",
"76": "Sahib",
"77": "SAIMS",
"78": "SanghviInnovative",
"79": "Sapient",
"80": "SGSITS",
"81": "SIMS",
"82": "SJDM",
"83": "SKSITS",
"84": "Softvision",
"85": "SVCE",
"86": "Rransnational",
"87": "Vaishnav",
"88": "Venkteshwar",
"89": "Vidhyasagar",
"90": "Vikrant",
"91": "Acropolis",
"92": "Aurobindo",
"93": "BM",
"94": "Central",
"95": "SOPE(DAVV)",
"96": "IIP(IIST)",
"97": "IPS",
"98": "Oriental",
"99": "Rishiraj",
"100": "RKDF",
"101": "Safe",
"102": "SGSITS",
"103": "Smriti(SCOPE)",
"104": "svce",
"105": "vikrant",
"106": "Arihant",
"107": "BombayHospital",
"108": "Index",
"109": "MGMMC",
"110": "RDMemorial",
"111": "Shubhdeep",
"112": "Aurobindo",
"113": "CDSH",
"114": "GCD",
"115": "Index",
"116": "Modern",
"117": "BIGAims",
"118": "Frameboxx",
"119": "INIFD",
"120": "MAAC",
"121": "SDPS",
"122": "SJMC(DAVV)",
"123": "VirtualVoyage",
"124": "Zica",
"125": "IPS",
"126": "SDPS",
"127": "Christian",
"128": "SOL(DAVV)",
"129": "IIL",
"130": "Vaishnav",
"132": "EMRC(DAVV)",
"P": "Jean-LucPicard",
"K": "JamesT.Kirk",
"#": "--------------------------------"
}
},
{
"name": "Arts",
"description": "Arts",
"type": "checkbox",
"value": "Arts"
},
{
"name": "Act",
"description": "Act",
"type": "checkbox",
"value": "Act"
},
{
"name": "Cooking",
"description": "Cooking",
"type": "checkbox",
"value": "Cooking"
},
{
"name": "Dance",
"description": "Dance",
"type": "checkbox",
"value": "Dance"
},
{
"name": "Designing",
"description": "Designing",
"type": "checkbox",
"value": "Designing"
},
{
"name": "Fashion",
"description": "Fashion Designing",
"type": "checkbox",
"value": "Fashion Designing"
},
{
"name": "Interior",
"description": "Interior Designing",
"type": "checkbox",
"value": "Interior Designing"
},
{
"name": "Modeling",
"description": "Modeling",
"type": "checkbox",
"value": "Modeling"
},
{
"name": "Photography",
"description": "Photography",
"type": "checkbox",
"value": "Photography"
},
{
"name": "Poetry",
"description": "Poetry / Writing",
"type": "checkbox",
"value": "Poetry / Writing"
},
{
"name": "Programming",
"description": "Programming",
"type": "checkbox",
"value": "Programming"
},
{
"name": "Reading",
"description": "Reading",
"type": "checkbox",
"value": "Reading"
},
{
"name": "Sketching",
"description": "Sketching / Drawing",
"type": "checkbox",
"value": "Sketching / Drawing"
},
{
"name": "Singing",
"description": "Singing",
"type": "checkbox",
"value": "Singing"
},
{
"name": "Sports",
"description": "Sports",
"type": "checkbox",
"value": "Sports"
},
{
"name": "Stunting",
"description": "Stunting",
"type": "checkbox",
"value": "Stunting"
},
{
"name": "Videography",
"description": "Checkthis",
"type": "checkbox",
"value": "Videography"
},
{
"name": "Other",
"description": "Other",
"type": "checkbox",
"value": "Other"
},
{
"name": "captcha"
}
]
Your fields parameter for Registration social plugin contain not valid JSON object (JSON should use double quotes instead of single quotes) and you're missing , (comma) in the middle of array, after next line:
{'name':'captain', 'description':'Best Captain', 'type':'select', 'options':{'P':'Jean-Luc Picard','K':'James T. Kirk'}}
Update:
Actually even usage of just valid JSON may not work in that case due to fact that this is passed as query string arguments, so that JSON should be properly encoded to avoid problems. Also may cause some issues.
Also you have two fields named "captain" (which cause problem with registration plugin too).
Here I've created some samples (due to massive code of fields, I'm not putting them here):
Creating fields from JavaScript object and passing em to Registration plugin: http://jsfiddle.net/QwdCv/
Correctly encoded fields in URL passed directly within iframe tag src attribute: http://jsfiddle.net/QwdCv/1/