It looks like you're new here. Sign in or register to get started.
IF JsonObject.Contains('item') = false THEN ..................... else ......................
[ { "id": "630", "item": "Item001", "affectedAmounts": { "fractionAmount": 0 } "fees": [] } ]
if jsObj.SelectToken('affectedAmounts.fractionAmount', jsToken) then ..........
Amount := SelectJsonToken(JsonObject,$.foreignAmount.amount).AsValue.AsDecimal()
IF JsonObject.Contains('foreignAmount') = true THEN begin Amount := SelectJsonToken(JsonObject,$.foreignAmount.amount).AsValue.AsDecimal(); end;
{ "AccountNumber": "************", "AccountCurrency": "USD", "AvailableBal": [ { "BalanceTypeCode": "OPBD", "AmountValue": 3534559.9, "AmountCcy": "USD", "CreditOrDebit": "CRDT", "Date": "2023-01-30" }, { "BalanceTypeCode": "CLAV", "AmountValue": 3133816.3, "AmountCcy": "SGD", "CreditOrDebit": "CRDT", "Date": "2023-01-13" }, .................. ] }
Answers
You could do something like this:
Regards
I tested this one error if not exist
so i just add like this
i want to get this nested json value (BalanceTypeCode Value)
my code
for i := 0 to JsonArray.Count - 1 do begin
JsonArray.get(i, JsonToken);
JsonObject := JsonToken.AsObject();
RetValue := GetJsonToken(JsonObject, '$.AvailableBal.BalanceTypeCode').AsValue.AsText();
end;
but it failed
Unable to convert from Microsoft.Dynamics.Nav.Runtime.NavJsonValue to Microsoft.Dynamics.Nav.Runtime.NavText.