Redigera

Dela via


JsonToken.ReadFrom(Text) Method

Version: Available or changed with runtime version 1.0.

Reads the JSON data from the string into a JsonToken variable.

Syntax

[Ok := ]  JsonToken.ReadFrom(String: Text)

Parameters

JsonToken
 Type: JsonToken
An instance of the JsonToken data type.

String
 Type: Text
The String object from which the JSON data will be read.

Return Value

[Optional] Ok
 Type: Boolean
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

This method can fail if the JSON data is malformed. If the operation succeeds, the JsonToken will be disconnected from its current JSON tree and the data contained by the JsonToken will be replaced with the new value. To delete the contents in a JsonToken variable use the Clear function.

Clear(JsonToken)

Example

This example shows how to read JSON data from a string into a JsonToken variable.

local procedure ReadJson(data : Text) result : JsonToken
begin
    result.ReadFrom(data);    
end;

JsonToken Data Type
Get Started with AL
Developing Extensions