Last active
September 30, 2021 20:41
-
-
Save xavierlopezpujol/5f630e647df295caf48c308961994de3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program Project1; | |
{$APPTYPE CONSOLE} | |
{$R *.res} | |
uses | |
Syncommons; | |
const | |
CurrentJson ='{'+ | |
'"success": true,'+ | |
'"message": "EcoDrivingIndex updated on 1 drivers"'+ | |
'}'; | |
// | |
//Whish to change to this | |
//{ | |
// "success": true, | |
// "message": "EcoDrivingIndex updated on 1 drivers", | |
// "driversnotfound": | |
// [ | |
// "293294", | |
// "293298" | |
// ] | |
//} | |
var json , JsonArray: variant; | |
begin | |
JsonArray := _Arr(['293294','293298']); | |
json := _Json(CurrentJson); | |
TDocVariantData(json).AddValue('driversnotfound',JsonArray); | |
// Testing | |
assert(TDocVariantData(json).A['driversnotfound'].Values[0]='293294'); | |
assert(TDocVariantData(json).A['driversnotfound'].Values[1]='293298'); | |
writeln(json); | |
readln; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment