Hi,
You can try getting json data with the following code when LoanType = 'Renewal':
String ls_ret
long ll_RootObject,ll_articles_array,ll_row_item,ll_loan_item
long ll_childcount,i
JsonParser lnv_JsonParser
lnv_JsonParser = create JsonParser
String ls_json
ls_json = &
'[{'+&
'"loanType": "NewLead",'+&
'"loan": {'+&
'"id": 7,'+&
'"loanType": "NewLead",'+&
'"ucid": 1,'+&
'"branchId": "1281",'+&
'"loanStatus": "Funded",'+&
'"amountPaidToCustomer": 44,'+&
'"jointType": "COSIGN"'+&
'}'+&
'},'+&
'{'+&
'"loanType": "FormerBorrower",'+&
'"loan": {'+&
'"id": 8,'+&
'"loanType": "FormerBorrower",'+&
'"ucid": 1,'+&
'"branchId": "1281",'+&
'"loanStatus": "Viewed",'+&
'"amountPaidToCustomer": 33,'+&
'"jointType": "INDVDUAL"'+&
'}'+&
'},'+&
'{'+&
'"loanType": "Renewal",'+&
'"loan": {'+&
'"loanId": 1,'+&
'"previousLoanPayOffAmount": 1285.5,'+&
'"previousAccountID": 1234,'+&
'"accountOption": null,'+&
'"id": 0,'+&
'"loanType": "Renewal",'+&
'"ucid": 1,'+&
'"branchId": "1281",'+&
'"loanStatus": "Pending",'+&
'"amountPaidToCustomer": 1250,'+&
'"jointType": "JOINT"'+&
'}'+&
'}]'
ls_ret = lnv_JsonParser.LoadString(ls_json)
If ls_ret <> '' Then
Messagebox('Load file Failed.',ls_ret)
Return
End If
ll_RootObject = lnv_JsonParser.GetRootItem()
ll_childcount = lnv_JsonParser.GetChildCount(ll_RootObject)
Long ll_id, ll_ucid,ll_amountPaidToCustomer, ll_previousAccountID
String ls_jointType, ls_loantype, ls_loanStatus,ls_branchId,ls_accountOption
Dec ls_previousLoanPayOffAmount
For i = 1 to ll_childcount
ll_row_item = lnv_JsonParser.GetChildItem(ll_RootObject, i)
ls_loanType = lnv_JsonParser.GetItemString(ll_row_item,'loanType')
If ls_loanType = 'Renewal' Then
ll_loan_item = lnv_JsonParser.GetItemObject(ll_row_item, "loan")
//ls_previousLoanPayOffAmount = lnv_JsonParser.GetItemDecimal(ll_loan_item,'previousLoanPayOffAmount') //Only PB 2022 support GetItemDecimal function
ll_previousAccountID = lnv_JsonParser.GetItemNumber(ll_loan_item,'previousAccountID')
If lnv_JsonParser.GetItemType(ll_loan_item,'accountOption') = JsonNullItem! Then
ls_accountOption = 'Null'
End If
ll_id = lnv_JsonParser.GetItemNumber(ll_loan_item,'id')
ls_loantype = lnv_JsonParser.GetItemString(ll_loan_item,'loanType')
ll_ucid = lnv_JsonParser.GetItemNumber(ll_loan_item,'ucid')
ls_branchId = lnv_JsonParser.GetItemString(ll_loan_item,'branchId')
ls_loanStatus = lnv_JsonParser.GetItemString(ll_loan_item,'loanStatus')
ll_amountPaidToCustomer = lnv_JsonParser.GetItemNumber(ll_loan_item,'amountPaidToCustomer')
ls_jointType = lnv_JsonParser.GetItemString(ll_loan_item,'jointType')
End If
Next