The extension helps you automatically generate JsonObject.Add(...) mappings based on predefined field mappings (such as Item, Customer, and Vendor).
It can also generate a full AL procedure for you, making integration work significantly faster and less error-prone.
Features
QuickFix triggered by BuildJson
Write BuildJson (or buildjson) on a new line in any AL file and press Ctrl + ..
You will be prompted to:
Select a standard Business Central table
(e.g., Item, Customer, Vendor)
Choose the output mode:
Generate a full AL procedure, or
Generate only the JsonObject.Add(...) lines
Automatic inserts missing variables
If your procedure is not generated by the extension, it can still complete it by adding missing elements.
Such as:
- JsonObject: JsonObject;
- <RecordVar>: Record <Table>;
- T: Text;
Additionally, the generator inserts JsonObject.WriteTo(T);
Example: Full procedure generation
procedure BuildJsonObjectItem(): Text;
var
JsonObject: JsonObject;
Item: Record Item;
T: Text;
begin
JsonObject.Add('no', Item."No.");
JsonObject.Add('description', Item."Description");
JsonObject.Add('unitPrice', Item."Unit Price");
// ...
JsonObject.WriteTo(T);
exit(T);
end;