Hello,
Up to this day I was using Newtonsoft.Json DotNet variables, but the problem is, that in AL it is not allowed to use DotNet variables.
There is a codeunit 5459 JSON Management available which has some external methods that I can use.
I want to store incoming JSON in the table similar to TB1236: JSON Buffer. I had to modify JSON Buffer's ReadFromText function a bit, so I would like to use some functions from JSON Management instead.
Here is the code from JSONBuffer.
ReadFromText(JsonText: Text)
JSONTextReader := JSONTextReader.JsonTextReader(StringReader.StringReader(JSONText));
IF JSONTextReader.Read THEN
REPEAT
INIT;
"Entry No." += 1;
Depth := JSONTextReader.Depth;
TokenType := JSONTextReader.TokenType;
"Token type" := TokenType;
IF ISNULL(JSONTextReader.Value) THEN
Value := ''
ELSE
SetValueWithoutModifying(FORMAT(JSONTextReader.Value));
IF ISNULL(JSONTextReader.ValueType) THEN
"Value Type" := ''
ELSE
"Value Type" := FORMAT(JSONTextReader.ValueType);
Path := JSONTextReader.Path;
INSERT;
UNTIL NOT JSONTextReader.Read;
I am not quite sure if I can modify that code to get the same result with JSON Management Codeunit.
I know I can use given JSON Buffer Table, but I would like to know if it's possible to get the same result by using the codeunit.
So my question is: Is it possible? And if yes, then how?
Thank you for your time.
Answers
Hit Ctrl+Space in the data type area and see what's available. There are many new ones that are essentially wrappers around common .net objects.
RIS Plus, LLC
The reason I wanted to use only JSON Management instead was that I wanted to have an easy upgrade to BC15 in the future.
You can request things that you think are missing by submitting a request here: https://github.com/Microsoft/ALAppExtensions, or here: https://aka.ms/BusinessCentralideas
RIS Plus, LLC
RIS Plus, LLC