【发布时间】:2018-01-29 17:34:29
【问题描述】:
我需要将 Salesforce 对象的嵌套结构序列化为 JSON,但结果解析不正确。
public class Checklist_JSON {
// class to represent the structure of the checklist
// one opportunity
// one account
// one finance checklist (custom object)
// one/more integration checklists, (custom objects) each with
// one/more campaigns (custom objects)
public opportunity this_opp{get;set;}
public account this_acc{get;set;}
public finance_checklist__c this_fin{get;set;}
public map <integration_checklist__c, list<ph_campaign__c>> ints_cams{get;set;}
}
然后我只是JSON.serialize(this_checklist_json);
可以正确解析除 integration_checklist__c 之外的所有对象的结果 - 即 ints_cams 映射的键集。
其他对象(帐户/oppty/等)每个都有一个节点“属性”,其中包含正确格式的名称/值对,例如
{"attributes":{"type":"Account","url":"/services/data/v42.0/sobjects/Account/0015E00000WDO8ZQAX"},"Id":"0015E00000WDO8ZQAX",
etc.
但 integration_checklist__c 没有“属性”节点,并且字段表示如下:
{"Integration_Checklist__c:{Id=a1E5E00000088lNUAQ, Name=INT-000339,
etc.
即“ID”周围没有引号:“a1E5E00000088lNUAQ”
有什么想法吗?提前致谢
【问题讨论】:
标签: json salesforce apex