I receive the following JSON string from an API function.
(我从API函数收到以下JSON字符串。)
"Inbound": {
"callRelatedFields": ["ANI",
"DNIS"],
"objects": {
"Contact": [{
"displayName": "Name",
"apiName": "Name"
},
{
"displayName": "Email",
"apiName": "Email"
}],
"Account": [{
"displayName": "Account Name",
"apiName": "Name"
},
{
"displayName": "Phone",
"apiName": "Phone"
},
{
"displayName": "Fax",
"apiName": "Fax"
}],
"cnx__Phone__c": [{
"displayName": "Phone Name",
"apiName": "Name"
},
{
"displayName": "Phone Number Line 1",
"apiName": "cnx__Phone_Number_Line_1__c"
},
{
"displayName": "Phone Number Line 2",
"apiName": "cnx__Phone_Number_Line_2__c"
},
{
"displayName": "Type",
"apiName": "cnx__Type__c"
},
{
"displayName": "Location",
"apiName": "cnx__Location__c"
},
{
"displayName": "Call Manager",
"apiName": "cnx__Call_Manager__c"
},
{
"displayName": "Mac Address",
"apiName": "cnx__Mac_Address__c"
}]
},
"screenPopSettings": {
"screenPopsOpenWithin": "ExistingWindow",
"SingleMatch": {
"screenPopType": "PopToEntity"
},
"NoMatch": {
"screenPopType": "DoNotPop"
},
"MultipleMatches": {
"screenPopType": "DoNotPop"
}
}
}
The order of the objects inside "objects"
is important!
("objects"
内"objects"
的顺序很重要!)
But when i parse this JSON string with JSON.parse
, the order of those objects is lost.(但是,当我使用JSON.parse
解析此JSON字符串时,这些对象的顺序将丢失。)
Is there any good way to keep the order of those objects after they are parsed.
(有什么好的方法可以在解析完这些对象后保持其顺序。)
I tried to manipulate the string and convert the whole "objects"
into an array, but this turned out to become way too complicated and hacky.
(我试图操纵该字符串并将整个"objects"
转换成一个数组,但是事实证明,这变得过于复杂和棘手。)
ask by Praind translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…