由于后台需要JSON数据,形成树的结构,导致我一整天在dorado前台拼接json数据,刚开始直接在按钮OnClick事件拼接,后来想了想,不太容易,之前也没有接触过JSON数据,对于格式也不太容易控制,故搜了下发现一个在线可以编辑,格式化,最重要的竟然可以帮忙转义,转义好后在dorado就很方便的调整了。网址如下
http://www.bejson.com/
附上刚完成的JSON数据,其中条款是循环,可能存放多条。
附上刚完成的JSON数据,其中条款是循环,可能存放多条。
1
var
propertyJson
=
"
{\
"
PropertyAllRisks\
"
:{\
"
actualId\
"
:\
"
\
"
,\
"
topactualId\
"
:\
"
\
"
,\
"
parentactualId\
"
:\
"
\
"
,
"
+
2 " \ " PolicyHolder\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
3 " \ " Contact\ " :\ " \ " , " +
4 " \ " CustomerType\ " :\ " \ " , " +
5 " \ " Mobile\ " :\ " \ " , " +
6 " \ " CustomerCode\ " :\ " \ " , " +
7 " \ " CustomerName\ " :\ "" +basicInfo.getValue( " PolicyHolder " )+ " \ " , " +
8 " \ " CertificateType\ " :\ " \ " , " +
9 " \ " CertificateNumber\ " :\ " \ " , " +
10 " \ " Address\ " :\ " \ " , " +
11 " \ " ZipCode\ " :\ " \ " , " +
12 " \ " Phone\ " :\ " \ " , " +
13 " \ " email\ " :\ " \ " , " +
14 " \ " IsBlanket\ " :\ " \ " , " +
15 " \ " IsVIP\ " :\ " \ " }, " +
16 " \ " AdditionalClause\ " :[ "
17 var clauseCount = dsPropertyClause.getVisibleCount();
18 var count = 0 ;
19 dsPropertyClause.moveFirst();
20 while ( ! dsPropertyClause.isLast()){
21 propertyJson = propertyJson + " {\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
22 " \ " ClauseType\ " :\ "" +dsPropertyClause.getValue( " ClauseType " )+ " \ " , " +
23 " \ " ClauseContent\ " :\ " \ " , " +
24 " \ " ClauseName\ " :\ "" +dsPropertyClause.getValue( " ClauseName " )+ " \ " , " ;
25 if (clauseCount - 1 == count){
26 propertyJson += " \ " ClauseNo\ " :\ " \ " } "
27 } else {
28 propertyJson += " \ " ClauseNo\ " :\ " \ " }, "
29 }
30 dsPropertyClause.moveNext();
31 count ++ ;
32 }
33 propertyJson = propertyJson + " ], \ " Deduction\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
34 " \ " DeductionTypeCode\ " :\ " \ " , " +
35 " \ " DeductibleCalculateMethod\ " :\ " \ " , " +
36 " \ " DeductibleOptionCode\ " :\ " \ " , " +
37 " \ " DeductibleRate\ " :\ "" +propertyExcess.getValue( " DeductibleRate " )+ " \ " , " +
38 " \ " DeductibleAmount\ " :\ "" +propertyExcess.getValue( " DeductibleAmount " )+ " \ " , " +
39 " \ " DeductibleModeCode\ " :\ " \ " , " +
40 " \ " CurrencyCode\ " :\ " \ " }, " +
41 " \ " OtherQuotationInfo\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
42 " \ " DangerousOfLoss\ " :\ "" +otherInfo.getValue( " DangerousOfLoss " )+ " \ " , " +
43 " \ " IsRenewalPolicy\ " :\ "" +booleanToNumber(otherInfo.getValue( " isRenewalPolicy " ))+ " \ " , " +
44 " \ " RenewalDifference\ " :\ "" +otherInfo.getValue( " RenewalDifference " )+ " \ " , " +
45 " \ " MarketTarget\ " :\ "" +otherInfo.getValue( " MarketTarget " )+ " \ " , " +
46 " \ " Idarv\ " :\ "" +otherInfo.getValue( " InsuranceDivisionAndRetentionViews " )+ " \ " , " +
47 " \ " IsSpecialBackward\ " :\ "" +booleanToNumber(otherInfo.getValue( " isSpecialBackward " ))+ " \ " , " +
48 " \ " RiskAnalysis\ " :\ "" +otherInfo.getValue( " RiskAnalysis " )+ " \ " , " +
49 " \ " IsOffshoreBusiness\ " :\ "" +booleanToNumber(otherInfo.getValue( " isOffshoreBusiness " ))+ " \ " , " +
50 " \ " Attachment\ " :\ " \ " }, " +
51 " \ " Premium\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
52 " \ " Premium\ " :\ "" +propertyCoverage.getValue( " Premium " )+ " \ " , " +
53 " \ " ExchangeRateAgreed\ " :\ "" +propertyCoverage.getValue( " ExchangeRateAgreed " )+ " \ " , " +
54 " \ " UnderwritingRates\ " :\ "" +propertyCoverage.getValue( " UnderwritingRates " )+ " \ " , " +
55 " \ " PremiumPayment\ " :\ "" +propertyCoverage.getValue( " PremiumPayment " )+ " \ " }, " +
56 " \ " PolicyBasicInfo\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
57 " \ " QuotationNo\ " :\ " \ " , " +
58 " \ " ShortTermRate\ " :\ " \ " , " +
59 " \ " StartTime\ " :\ " \ " , " +
60 " \ " EndTime\ " :\ " \ " , " +
61 " \ " BusinessMethod\ " :\ " \ " , " +
62 " \ " ApplicationNo\ " :\ " \ " , " +
63 " \ " PolicyNo\ " :\ " \ " , " +
64 " \ " RenewalPolicyNo\ " :\ " \ " , " +
65 " \ " TempPolicyNo\ " :\ " \ " , " +
66 " \ " DisputeResolution\ " :\ " \ " , " +
67 " \ " ArbitrationInstitution\ " :\ "" +otherInfo.getValue( " ArbitrationInstitution " )+ " \ " , " +
68 " \ " Jurisdiction\ " :\ " \ " , " +
69 " \ " RiskType\ " :\ " \ " , " +
70 " \ " IsSpecialBusiness\ " :\ " \ " , " +
71 " \ " SellingExpenseRate\ " :\ " \ " , " +
72 " \ " IsInterSellingOfHeadOffice\ " :\ " \ " , " +
73 " \ " Comments\ " :\ " \ " , " +
74 " \ " HandlerCode\ " :\ " \ " , " +
75 " \ " OffersiteCode\ " :\ " \ " , " +
76 " \ " ShortTermMethod\ " :\ " \ " , " +
77 " \ " NumInsured\ " :\ " \ " , " +
78 " \ " PolicyStatus\ " :\ " \ " , " +
79 " \ " EndorsementTimes\ " :\ " \ " , " +
80 " \ " StartDate\ " :\ "" +startDateFormat+ " \ " , " +
81 " \ " BusinessOrg\ " :\ " \ " , " +
82 " \ " EndDate\ " :\ "" +endDateFormat+ " \ " , " +
83 " \ " ClaimTimes\ " :\ " \ " , " +
84 " \ " CoinsuranceMethod\ " :\ " \ " , " +
85 " \ " ProductCode\ " :\ " \ " , " +
86 " \ " CoverageTerritory\ " :\ "" +basicInfo.getValue( " Underwriter " )+ " \ " , " +
87 " \ " ExpirationDate\ " :\ "" +getDate(2)+ " \ " , " +
88 " \ " InputDate\ " :\ "" +getDate(1)+ " \ " , " +
89 " \ " InputMethod\ " :\ " \ " }, " +
90 " \ " PolicyPremiumInfo\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
91 " \ " PolicyPremiumChange\ " :\ " \ " , " +
92 " \ " PolicySumInsuredChange\ " :\ " \ " , " +
93 " \ " PolicyPremium\ " :\ " \ " , " +
94 " \ " CurrencyCode\ " :\ " \ " , " +
95 " \ " PolicySumInsured\ " :\ "" +propertyCoverage.getValue( " SumInsured " )+ " \ " }, " +
96 " \ " Insurant\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
97 " \ " Mobile\ " :\ " \ " , " +
98 " \ " CustomerType\ " :\ " \ " , " +
99 " \ " Phone\ " :\ " \ " , " +
100 " \ " ZipCode\ " :\ " \ " , " +
101 " \ " Address\ " :\ " \ " , " +
102 " \ " CertificateNumber\ " :\ " \ " , " +
103 " \ " CertificateType\ " :\ " \ " , " +
104 " \ " CustomerName\ " :\ "" +basicInfo.getValue( " Insured " )+ " \ " , " +
105 " \ " CustomerCode\ " :\ " \ " , " +
106 " \ " email\ " :\ " \ " }, " +
107 " \ " Broker\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
108 " \ " CustomerName\ " :\ "" +basicInfo.getValue( " Broker " )+ " \ " , " +
109 " \ " Brokerage\ " :\ "" +basicInfo.getValue( " Brokerage " )+ " \ " }, " +
110 " \ " QuotationBasicInfo\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
111 " \ " AcceptInsuranceProjectName\ " :\ "" +basicInfo.getValue( " AcceptInsuranceProjectName " )+ " \ " , " +
112 " \ " Location\ " :\ "" +basicInfo.getValue( " Location " )+ " \ " }}} "
2 " \ " PolicyHolder\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
3 " \ " Contact\ " :\ " \ " , " +
4 " \ " CustomerType\ " :\ " \ " , " +
5 " \ " Mobile\ " :\ " \ " , " +
6 " \ " CustomerCode\ " :\ " \ " , " +
7 " \ " CustomerName\ " :\ "" +basicInfo.getValue( " PolicyHolder " )+ " \ " , " +
8 " \ " CertificateType\ " :\ " \ " , " +
9 " \ " CertificateNumber\ " :\ " \ " , " +
10 " \ " Address\ " :\ " \ " , " +
11 " \ " ZipCode\ " :\ " \ " , " +
12 " \ " Phone\ " :\ " \ " , " +
13 " \ " email\ " :\ " \ " , " +
14 " \ " IsBlanket\ " :\ " \ " , " +
15 " \ " IsVIP\ " :\ " \ " }, " +
16 " \ " AdditionalClause\ " :[ "
17 var clauseCount = dsPropertyClause.getVisibleCount();
18 var count = 0 ;
19 dsPropertyClause.moveFirst();
20 while ( ! dsPropertyClause.isLast()){
21 propertyJson = propertyJson + " {\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
22 " \ " ClauseType\ " :\ "" +dsPropertyClause.getValue( " ClauseType " )+ " \ " , " +
23 " \ " ClauseContent\ " :\ " \ " , " +
24 " \ " ClauseName\ " :\ "" +dsPropertyClause.getValue( " ClauseName " )+ " \ " , " ;
25 if (clauseCount - 1 == count){
26 propertyJson += " \ " ClauseNo\ " :\ " \ " } "
27 } else {
28 propertyJson += " \ " ClauseNo\ " :\ " \ " }, "
29 }
30 dsPropertyClause.moveNext();
31 count ++ ;
32 }
33 propertyJson = propertyJson + " ], \ " Deduction\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
34 " \ " DeductionTypeCode\ " :\ " \ " , " +
35 " \ " DeductibleCalculateMethod\ " :\ " \ " , " +
36 " \ " DeductibleOptionCode\ " :\ " \ " , " +
37 " \ " DeductibleRate\ " :\ "" +propertyExcess.getValue( " DeductibleRate " )+ " \ " , " +
38 " \ " DeductibleAmount\ " :\ "" +propertyExcess.getValue( " DeductibleAmount " )+ " \ " , " +
39 " \ " DeductibleModeCode\ " :\ " \ " , " +
40 " \ " CurrencyCode\ " :\ " \ " }, " +
41 " \ " OtherQuotationInfo\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
42 " \ " DangerousOfLoss\ " :\ "" +otherInfo.getValue( " DangerousOfLoss " )+ " \ " , " +
43 " \ " IsRenewalPolicy\ " :\ "" +booleanToNumber(otherInfo.getValue( " isRenewalPolicy " ))+ " \ " , " +
44 " \ " RenewalDifference\ " :\ "" +otherInfo.getValue( " RenewalDifference " )+ " \ " , " +
45 " \ " MarketTarget\ " :\ "" +otherInfo.getValue( " MarketTarget " )+ " \ " , " +
46 " \ " Idarv\ " :\ "" +otherInfo.getValue( " InsuranceDivisionAndRetentionViews " )+ " \ " , " +
47 " \ " IsSpecialBackward\ " :\ "" +booleanToNumber(otherInfo.getValue( " isSpecialBackward " ))+ " \ " , " +
48 " \ " RiskAnalysis\ " :\ "" +otherInfo.getValue( " RiskAnalysis " )+ " \ " , " +
49 " \ " IsOffshoreBusiness\ " :\ "" +booleanToNumber(otherInfo.getValue( " isOffshoreBusiness " ))+ " \ " , " +
50 " \ " Attachment\ " :\ " \ " }, " +
51 " \ " Premium\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
52 " \ " Premium\ " :\ "" +propertyCoverage.getValue( " Premium " )+ " \ " , " +
53 " \ " ExchangeRateAgreed\ " :\ "" +propertyCoverage.getValue( " ExchangeRateAgreed " )+ " \ " , " +
54 " \ " UnderwritingRates\ " :\ "" +propertyCoverage.getValue( " UnderwritingRates " )+ " \ " , " +
55 " \ " PremiumPayment\ " :\ "" +propertyCoverage.getValue( " PremiumPayment " )+ " \ " }, " +
56 " \ " PolicyBasicInfo\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
57 " \ " QuotationNo\ " :\ " \ " , " +
58 " \ " ShortTermRate\ " :\ " \ " , " +
59 " \ " StartTime\ " :\ " \ " , " +
60 " \ " EndTime\ " :\ " \ " , " +
61 " \ " BusinessMethod\ " :\ " \ " , " +
62 " \ " ApplicationNo\ " :\ " \ " , " +
63 " \ " PolicyNo\ " :\ " \ " , " +
64 " \ " RenewalPolicyNo\ " :\ " \ " , " +
65 " \ " TempPolicyNo\ " :\ " \ " , " +
66 " \ " DisputeResolution\ " :\ " \ " , " +
67 " \ " ArbitrationInstitution\ " :\ "" +otherInfo.getValue( " ArbitrationInstitution " )+ " \ " , " +
68 " \ " Jurisdiction\ " :\ " \ " , " +
69 " \ " RiskType\ " :\ " \ " , " +
70 " \ " IsSpecialBusiness\ " :\ " \ " , " +
71 " \ " SellingExpenseRate\ " :\ " \ " , " +
72 " \ " IsInterSellingOfHeadOffice\ " :\ " \ " , " +
73 " \ " Comments\ " :\ " \ " , " +
74 " \ " HandlerCode\ " :\ " \ " , " +
75 " \ " OffersiteCode\ " :\ " \ " , " +
76 " \ " ShortTermMethod\ " :\ " \ " , " +
77 " \ " NumInsured\ " :\ " \ " , " +
78 " \ " PolicyStatus\ " :\ " \ " , " +
79 " \ " EndorsementTimes\ " :\ " \ " , " +
80 " \ " StartDate\ " :\ "" +startDateFormat+ " \ " , " +
81 " \ " BusinessOrg\ " :\ " \ " , " +
82 " \ " EndDate\ " :\ "" +endDateFormat+ " \ " , " +
83 " \ " ClaimTimes\ " :\ " \ " , " +
84 " \ " CoinsuranceMethod\ " :\ " \ " , " +
85 " \ " ProductCode\ " :\ " \ " , " +
86 " \ " CoverageTerritory\ " :\ "" +basicInfo.getValue( " Underwriter " )+ " \ " , " +
87 " \ " ExpirationDate\ " :\ "" +getDate(2)+ " \ " , " +
88 " \ " InputDate\ " :\ "" +getDate(1)+ " \ " , " +
89 " \ " InputMethod\ " :\ " \ " }, " +
90 " \ " PolicyPremiumInfo\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
91 " \ " PolicyPremiumChange\ " :\ " \ " , " +
92 " \ " PolicySumInsuredChange\ " :\ " \ " , " +
93 " \ " PolicyPremium\ " :\ " \ " , " +
94 " \ " CurrencyCode\ " :\ " \ " , " +
95 " \ " PolicySumInsured\ " :\ "" +propertyCoverage.getValue( " SumInsured " )+ " \ " }, " +
96 " \ " Insurant\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
97 " \ " Mobile\ " :\ " \ " , " +
98 " \ " CustomerType\ " :\ " \ " , " +
99 " \ " Phone\ " :\ " \ " , " +
100 " \ " ZipCode\ " :\ " \ " , " +
101 " \ " Address\ " :\ " \ " , " +
102 " \ " CertificateNumber\ " :\ " \ " , " +
103 " \ " CertificateType\ " :\ " \ " , " +
104 " \ " CustomerName\ " :\ "" +basicInfo.getValue( " Insured " )+ " \ " , " +
105 " \ " CustomerCode\ " :\ " \ " , " +
106 " \ " email\ " :\ " \ " }, " +
107 " \ " Broker\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
108 " \ " CustomerName\ " :\ "" +basicInfo.getValue( " Broker " )+ " \ " , " +
109 " \ " Brokerage\ " :\ "" +basicInfo.getValue( " Brokerage " )+ " \ " }, " +
110 " \ " QuotationBasicInfo\ " :{\ " actualId\ " :\ " \ " ,\ " topactualId\ " :\ " \ " , " +
111 " \ " AcceptInsuranceProjectName\ " :\ "" +basicInfo.getValue( " AcceptInsuranceProjectName " )+ " \ " , " +
112 " \ " Location\ " :\ "" +basicInfo.getValue( " Location " )+ " \ " }}} "