Codeunit 2516 AppSource Json Utilities in 27
- App
- System Application
- Namespace
- System.Apps.AppSource
Versions171819202122232425262728latest
Source in 27
src/System Application/App/AppSource Gallery/src/AppSourceJsonUtilities.Codeunit.al65 lines, Copyright (c) Microsoft Corporation. MIT
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace System.Apps.AppSource;
/// <summary>
/// Library for managing AppSource product retrieval and usage.
/// </summary>
codeunit 2516 "AppSource Json Utilities"
{
Access = Internal;
InherentEntitlements = x;
InherentPermissions = X;
procedure GetDecimalValue(JsonObject: JsonObject; PropertyName: Text): Decimal
var
JsonValue: JsonValue;
begin
if GetJsonValue(JsonObject, PropertyName, JsonValue) then
exit(JsonValue.AsDecimal());
exit(0);
end;
procedure GetIntegerValue(JsonObject: JsonObject; PropertyName: Text): Integer
var
JsonValue: JsonValue;
begin
if GetJsonValue(JsonObject, PropertyName, JsonValue) then
exit(JsonValue.AsInteger());
exit(0);
end;
procedure GetDateTimeValue(JsonObject: JsonObject; PropertyName: Text): DateTime
var
JsonValue: JsonValue;
begin
if GetJsonValue(JsonObject, PropertyName, JsonValue) then
exit(JsonValue.AsDateTime());
exit(0DT);
end;
procedure GetStringValue(JsonObject: JsonObject; PropertyName: Text): Text
var
JsonValue: JsonValue;
begin
if GetJsonValue(JsonObject, PropertyName, JsonValue) then
exit(JsonValue.AsText());
exit('');
end;
procedure GetJsonValue(JsonObject: JsonObject; PropertyName: Text; var ReturnValue: JsonValue): Boolean
var
JsonToken: JsonToken;
begin
if JsonObject.Contains(PropertyName) then
if JsonObject.Get(PropertyName, JsonToken) then
if not JsonToken.AsValue().IsNull() then begin
ReturnValue := JsonToken.AsValue();
exit(true);
end;
exit(false);
end;
}
Procedures, 5
| Name | Parameters | Returns | Access | Obsolete |
|---|---|---|---|---|
| GetDecimalValue | (JsonObject, Text) | Decimal | public | - |
| GetIntegerValue | (JsonObject, Text) | Integer | public | - |
| GetDateTimeValue | (JsonObject, Text) | DateTime | public | - |
| GetStringValue | (JsonObject, Text) | Text | public | - |
| GetJsonValue | (JsonObject, Text, var JsonValue) | Boolean | public | - |