Skip to content
Arthur van de Vondervoort edited this page Dec 14, 2024 · 3 revisions

Replace double quotes in JPath expressions with two single quotes.

This rule raises a diagnostic when double quotes (") are used in JPath expressions within SelectToken method calls on JsonToken objects. In Business Central, JPath expressions require strings to be wrapped with two single quotes ('') instead of double quotes. Using double quotes causes the expression to fail, often resulting in no output.

Example

procedure MyProcedure()
var
    Customer: JsonToken;
    Result: JsonToken;
begin
    // Double quote character detected in JPath expression. Replace all double quotes (") with two single quotes ('').
    Customer.SelectToken('$.custom_attributes[?(@.attribute_code == "activation_status")].value', Result);
end;

Read more:

Clone this wiki locally