Winsoft JSON Library v4.6 for Delphi/C++ Builder 6 - 10.4 Sydney Full Source
Winsoft JSON Library v4.6 for Delphi/C++ Builder 6 - 10.4 Sydney Full Source
Delphi and C++ Builder jаvascript Object Notation (JSON) library.. full JSON supported: literals, numbers, strings, arrays and objects.
full JSON supported: literals, numbers, strings, arrays and objects
date/time encoding and decoding supported
customizable output
provides in-memory and streaming JSON parsers and generators
supports Windows, macOS, iOS and Android
available for Delphi/C++ Builder 6 - 10.4 and Lazarus 2.0.8
source code included in registered version
royalty free distribution in applications
Read and modify existing json file:
var Json: TJson;
with TJsonParser.Create do
try
Json := ParseUtf8File('c:\data.json');
try
ShowMessage(Json.ToString);
finally
Json.Free;
end;
finally
Free;
end;
Create new json file:
var
MyArray: TJsonArray;
MyObject: TJsonObject;
with TJsonObject.Create do
try
SetNull('Null');
SetTrue('True');
SetFalse('False');
SetNumber('Number', 1.23);
SetString('String', 'hello');
SetDateTime('DateTime', Now);
MyArray := SetArray('Array', 3);
MyArray.SetString(0, 'First item');
MyArray.SetString(1, 'Second item');
MyArray.SetNumber(2, 3.21);
MyObject := SetObject('Object');
MyObject.SetString('First Member', 'Hello');
MyObject.SetString('Second Member', 'World');
MyObject.SetFalse('Third Member');
MyObject.SetTrue('Fourth Member');
MyObject.SetNumber('Other Member', 1.11);
ShowMessage(ToString);
ToUtf8File('c:\new.json');
finally
Free;
end;
Use fast, streaming TJsonWriter to create json file without in-memory overhead of TJson objects:
with TJsonWriter.Create('c:\data.json') do
try
BeginObject;
WriteNull('Null');
Write('True', True);
Write('False', False);
Write('Number', 1.23);
Write('String', 'hello');
Write('DateTime', Now, 0);
BeginArray('Array');
Write('First item');
Write('Second item');
Write(3.21);
EndArray;
BeginObject('Object');
Write('First Member', 'Hello');
Write('Second Member', 'World');
Write('Third Member', False);
Write('Fourth Member', True);
Write('Other Member', 1.11);
EndObject;
EndObject;
Check;
finally
Free;
end;
Use fast, streaming TJsonReader to read json file without in-memory overhead of TJson objects:
var
JsonItem: TJsonItem;
Prefix: WideString;
with TJsonReader.Create('c:\data.json', True, True) do
try
repeat
JsonItem := Read;
if IsMember then
Prefix := '"' + MemberName + '" : '
else
Prefix := '';
case JsonItem of
itNull: ShowMessage(Prefix + 'null');
itFalse: ShowMessage(Prefix + 'false');
itTrue: ShowMessage(Prefix + 'true');
itNumber: ShowMessage(Prefix + FloatToStr(NumberValue));
itString: ShowMessage(Prefix + '"' + StringValue + '"');
itBeginArray: ShowMessage(Prefix + '[');
itEndArray: ShowMessage(Prefix + ']');
itBeginObject: ShowMessage(Prefix + '{');
itEndObject: ShowMessage(Prefix + '}');
end;
until JsonItem = itEof;
finally
Free;
end;
Only for V.I.P
Warning! You are not allowed to view this text.