Hi experts,
I am calling the API from X++ Dynamics 365 FO. After the POST request is sent, the API will return a JSON with 4 variables to me, which are Access Token, Expires In, Token Type and Scope. However, when I tried to deserialize it, it returns empty as shown in the debug output window.
I would like to ask how can I deserialize the JSON string in X++.
I have the Token class written in X++ as follow:
using System.Attribute;
using System.Text.Json;
using System.Text.Json.Serialization;
public class Token
{
public str accessToken;
str tokenType;
int expiresIn;
str scope;
[JsonPropertyName(/access_token/)]
public str AccessToken(str _accessToken = accessToken)
{
accessToken = _accessToken;
return accessToken;
}
[JsonPropertyName(/token_type/)]
public str TokenType(str _tokenType = tokenType)
{
tokenType = _tokenType;
return tokenType;
}
[JsonPropertyName(/expires_in/)]
public int ExpiresIn(int _expiresIn = expiresIn)
{
expiresIn = _expiresIn;
return expiresIn;
}
[JsonPropertyName(/scope/)]
public str Scope(str _scope = scope)
{
scope = _scope;
return scope;
}
}