gpt4 book ai didi

json - swift - 表达式太复杂

转载 作者:行者123 更新时间:2023-11-30 13:02:05 26 4
gpt4 key购买 nike

我必须发送一个非常大的 JSON 文件。在制作该 JSON 文件的过程中,xcode 给出编译时错误:表达式太复杂,无法实时解析。

我也尝试过使用 SwiftyJson 来实现此目的。即使我将大字符串分成较小的字符串,由于“+”运算符的数量较多,它也会给我带来同样的错误。有人有解决办法吗?

这是代码:`et jsonObject: JSON = [

        "salesAgentID": SalesAgentID,

"customerInformation": [

"customerName": CustomerInfo[1],
"company": CustomerInfo[2],
"address" : CustomerInfo[3],
"city" : CustomerInfo[4],
"postalCode" : CustomerInfo[5],
"mobile" : CustomerInfo[6],
"phone" : CustomerInfo[7],
"email" : CustomerInfo[8],
"deliveryAddress" : CustomerInfo[9]


],


"measurements": [

"point": String(uiSliderArray[0]),
"halfBody": String(uiSliderArray[1]),
"fullBody": String(uiSliderArray[2]),
"kneeLength" : String(uiSliderArray[3]),
"shortLength" : String(uiSliderArray[4]),
"longLength" : String(uiSliderArray[5]),
"chesy": String(uiSliderArray[6]),
"bust": String(uiSliderArray[7]),
"waist": String(uiSliderArray[8]),
"smallHip" : String(uiSliderArray[9]),
"hips" : String(uiSliderArray[10]),
"shoulder" : String(uiSliderArray[11]),
"backCarrue": String(uiSliderArray[12]),
"frontCarrue": String(uiSliderArray[13]),
"backNeck": String(uiSliderArray[14]),
"frontNeck" : String(uiSliderArray[15]),
"widthOfNeckline" : String(uiSliderArray[16]),
"sleevesFull" : String(uiSliderArray[17]),
"sleevesThreeQuarter": String(uiSliderArray[18]),
"elbow": String(uiSliderArray[19]),
"sleevesHalf": String(uiSliderArray[20]),
"bicep" : String(uiSliderArray[21]),
"empire" : String(uiSliderArray[22]),
"armhole" : String(uiSliderArray[23]),
"lowerLength": String(uiSliderArray[24]),
"lowerWaist" : String(uiSliderArray[25]),
"thigh" : String(uiSliderArray[26]),
"kneeLength2" : String(uiSliderArray[27]),
"calf": String(uiSliderArray[28]),
"ankle": String(uiSliderArray[29])
],

"Order": [

"agentID": SalesAgentID,
"orderStatus": orderStatus,
"reference": referenceTextField.text,
"advancePaid" : advancePaidTextField.text,
"totalPayment" : totalPaymentTextField.text,
"choli" : ArrayforDressTypeSelection[0][0],
"shirt" : ArrayforDressTypeSelection[0][1],
"angrakha" :ArrayforDressTypeSelection[0][2],
"jacket": ArrayforDressTypeSelection[0][3],
"longSleeve" : ArrayforDressTypeSelection[1][0],
"threeQuarterSleeve" : ArrayforDressTypeSelection[1][1],
"elbowSleeve" : ArrayforDressTypeSelection[1][2],
"sleeveless" : ArrayforDressTypeSelection[1][3],
"saree" : ArrayforDressTypeSelection[2][0],
"gown" : ArrayforDressTypeSelection[3][0],
"cigarettePant" : ArrayforDressTypeSelection[4][0],
"bootcutPant" : ArrayforDressTypeSelection[4][1],
"izaar" : ArrayforDressTypeSelection[4][2],
"lehengaWithTrail" : ArrayforDressTypeSelection[4][3],
"lehengaWithoutTrail" : ArrayforDressTypeSelection[4][4],
"sharara" : ArrayforDressTypeSelection[4][5],
"gharara" : ArrayforDressTypeSelection[4][6],
"dhotiShalwar" : ArrayforDressTypeSelection[4][7],
"shalwar" : ArrayforDressTypeSelection[4][8],
"flaredPant" : ArrayforDressTypeSelection[4][9]



]


]`

最佳答案

我建议创建类测量、订单等,然后使用类函数从类对象创建 JSON 对象(或字典),然后将它们联合起来。

关于json - swift - 表达式太复杂,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39808301/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com