0
我正在开发一个Salesforce CRM项目,我需要访问Google表格中的值,扫描某些关键字,并且如果它们符合特定条件,请复制给定行中的数据转换为Salesforce中的对象。解析来自Google表格的JSON响应
我使用Google Sheets API和Apex - Salesforce编程语言访问Google表格的正文。 我遇到的问题是,我从Google表格文件获取的每个数据行都是单独的JSON文件。
正如您将在下面的示例中看到的,键仅位于第一个JSON文件中,那么后面的每个文件都只包含值。
有没有办法将每个包含值(从第二个起)的JSON文件与第一个文件中的键配对?
这里的JSON响应的样子:
"range": "Angels!B2:AD2501",
"majorDimension": "ROWS",
"values": [
[
"Complete?",
"Name",
"ID :",
"Source",
"LinkedIn",
"Twitter",
"Profile",
"",
"AA Profile",
"Email",
"Location: City",
"Location: Country",
"Twitter Bio",
"Bio",
"Known For:",
"Investments",
"Preferred Industry",
"Vertical",
"Associated Venture Fund",
"Type",
"Total Investments",
"Total Exits",
"",
"Priority",
"Comments",
"Email",
"Contact Owner",
"Account Owner",
"In CRM"
],
[
"Yes",
"John Doe",
"2305",
"CrowdSourced",
"https://www.linkedin.com/in/someone-34738265",
"",
"",
"",
"https://angel.co/person",
"",
"Something",
"UK",
"",
"Executive Manager",
"Long term investor.",
"list, of, companies, separated,by, a, comma",
"IT, Advertising",
"",
"",
"Person (individual)",
"239",
"16",
"TRUE",
"H"
],
[
"Yes",
"A. Nikiforov",
"766",
"Pitchbook2",
"https://www.linkedin.com/pub/dir/alexey/nikiforov",
"",
"https://my.pitchbook.com?i=106763-86",
"",
"",
"[email protected]",
"Saint Petersburg",
"Russia",
"",
"Mr. A. Nikiforov is the Owner at Izdatelstvo Politekhnika. Mr. A. Nikiforov is the Owner at A. Nikiforov.",
" ",
"Izdatelstvo Politekhnika",
"Media",
"",
"",
"Angel (individual)",
"1",
"",
"FALSE"
],
[
"Yes",
"Aarish Patel",
"1043",
"Pitchbook2",
"https://www.linkedin.com/in/aarish-patel-06387983",
"",
"https://my.pitchbook.com?i=151254-01",
"",
"",
"",
"",
"",
"",
"Mr. Patel serves as the Non-Executive Director at Reds True Barbecue. He serves as the Angel Investor at Aarish Patel.",
" ",
"Reds True Barbecue",
"Restaurants, Hotels and Leisure, Retail",
"",
"",
"Angel (individual)",
"1",
"",
"FALSE"
]];
谢谢马特,上述工作,但现在我面临一个堆大小太大的问题(这是一个包含2500行数据的电子表格)。 –
这太糟糕了,要弄清楚的是JSONString本身是否太大,或者代码的其他方面是否导致异常。要测试的内容是注释代码的一部分,并尝试使用较小的JSON文件。 –
嘿马特,那就是我所做的。我将JSON分成更小的块,现在它正在工作。感谢您对此的所有帮助! –