# JsonToken.SelectToken(Text, var JsonToken) Method
> Version: _Available or changed with runtime version 1.0._
Selects a JsonToken using a JPath expression.
## Syntax
```al
[Ok := ]  JsonToken.SelectToken(Path: Text, var Result: JsonToken)
```
## Parameters
JsonToken
Type: jsontoken-data-type
An instance of the jsontoken-data-type data type.
Path
Type: ../text/text-data-type
A valid JPath expression.
Result
Type: jsontoken-data-type
A JsonToken variable that will contain the result if the operation is successful.
## Return Value
*[Optional] Ok*
Type: ../boolean/boolean-data-type
true if the read was successful; otherwise, false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.
## Remarks
The operation will fail if more or less than 1 tokens are the result of evaluating the JPath.
## Example
The following example shows how to select a value from a complex JSON Object. We build up a select expression in the query variable, we select the token corresponding to the salary of the employee with the given employeeId, and finally, we convert the token to a Decimal value.
We assume that the company token contains JSON data similar to the one below.
```json
{ "company": {
    "employees": [
      { "id": "Marcy",
        "salary": 8.95
      },
      { "id": "John",
        "salary": 7
      },
      { "id": "Diana",
        "salary": 10.95
      }
    ]
  }
}
```
```al
local procedure SelectEmployeeSalary(companyData : JsonToken; employeeId : Text) salary : Decimal
var
    query : Text;
    salaryToken : JsonToken;
begin
    query := '$.company.employees[?(@.id=='''+employeeId+''')].salary';
    companyData.SelectToken(query, salaryToken);

    salary := salaryToken.AsValue().AsDecimal();
end;
```
> NOTE
> Ensure that the selected expression contains ' (single quotation mark) and not " (double quotation mark) to decorate the string value.
## Related information
jsontoken-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/jsontoken/jsontoken-selecttoken-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/jsontoken/jsontoken-selecttoken-method/
