Skip to content

Commit a139002

Browse files
committed
Repo Update
- Renamed Set methods to Put - Added Anchor property - Renamed AsInteger to AsInt32 - Added AsUInt32, AsInt64 and AsUInt64 methods - Misc. fixes and enhanceements
1 parent 96c4aba commit a139002

File tree

5 files changed

+647
-323
lines changed

5 files changed

+647
-323
lines changed

README.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ Getting started with `TEasyJson` is quick and easy:
3030
var EJ: TEasyJson;
3131
begin
3232
EJ := TEasyJson.Create;
33-
EJ.&Set('name', 'Alice')
34-
.&Set('age', 25)
33+
EJ.Put('name', 'Alice')
34+
.Put('age', 25)
3535
.AddArray('hobbies')
36-
.&Set(0, 'Reading')
37-
.&Set(1, 'Cycling');
36+
.Put(0, 'Reading')
37+
.Put(1, 'Cycling');
3838
3939
WriteLn(EJ.Format());
4040
end;
@@ -63,8 +63,8 @@ end;
6363

6464
### 🔹 Adding and Modifying Values
6565
```delphi
66-
EJ.&Set('email', 'alice@example.com');
67-
EJ.&Set('age', 26); // Updates existing key
66+
EJ.Put('email', 'alice@example.com');
67+
EJ.Put('age', 26); // Updates existing key
6868
```
6969

7070
### 🔹 Working with JSON Arrays
@@ -73,9 +73,9 @@ var EJ: TEasyJson;
7373
begin
7474
EJ := TEasyJson.Create;
7575
EJ.AddArray('numbers')
76-
.&Set(0, 10)
77-
.&Set(1, 20)
78-
.&Set(2, 30);
76+
.Put(0, 10)
77+
.Put(1, 20)
78+
.Put(2, 30);
7979
8080
WriteLn(EJ.Format());
8181
end;
@@ -86,8 +86,8 @@ end;
8686
EJ.AddObject('address',
8787
function(E: TEasyJson): TEasyJson
8888
begin
89-
Result := E.&Set('city', 'New York')
90-
.&Set('zip', '10001');
89+
Result := E.Put('city', 'New York')
90+
.Put('zip', '10001');
9191
end);
9292
```
9393

@@ -108,22 +108,24 @@ The `TEasyJson` class provides a robust set of methods and properties for seamle
108108
- `Create(const AJsonValue: TJSONValue)` – Wraps an existing JSON value.
109109

110110
### 🔹 Methods
111-
- `Set(AKey: string; AValue: Variant): TEasyJson` – Adds or updates a key.
112-
- `Set(AIndex: Integer; AValue: Variant): TEasyJson` – Sets an array element.
111+
- `Put(AKey: string; AValue: Variant): TEasyJson` – Adds or updates a key.
112+
- `Put(AIndex: Integer; AValue: Variant): TEasyJson` – Sets an array element.
113113
- `Add(AKey: string; AValue: Variant): TEasyJson` – Adds a new key-value pair.
114114
- `AddArray(AKey: string): TEasyJson` – Adds an empty array.
115115
- `AddObject(AKey: string; AFunc: TFunc<TEasyJson, TEasyJson>): TEasyJson` – Adds a nested object.
116116
- `ToString(): string` – Returns a compact JSON string.
117117
- `Format(): string` – Returns formatted JSON.
118118
- `Count(): Integer` – Returns the number of elements.
119119
- `AsString(): string` – Converts a JSON value to a string.
120-
- `AsInteger(): Integer` – Converts a JSON value to an integer.
120+
- `AsInt32r(): Int32` – Converts a JSON value to an int32.
121121
- `AsFloat(): Double` – Converts a JSON value to a float.
122122
- `AsBoolean(): Boolean` – Converts a JSON value to a boolean.
123123

124124
### 🔹 Properties
125125
- `Items[AKeyOrIndex: Variant]: TEasyJson` – Accesses elements by key or index.
126126

127+
See `EasyJson.pas` for the full documented API.
128+
127129
## 💬 Support & Resources
128130

129131
- 🐞 **Report Issues:** [GitHub Issue Tracker](https://github.com/tinyBigGAMES/EasyJson/issues)

examples/testbed/Testbed.dpr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ uses
2727
EasyJson in '..\..\src\EasyJson.pas';
2828

2929
begin
30+
ReportMemoryLeaksOnShutdown := True;
3031
try
3132
RunTests();
3233
except

examples/testbed/Testbed.dsv

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[ClosedView_QzpcRGV2XERlbHBoaVxQcm9qZWN0c1xFYXN5SnNvblxyZXBvXHNyY1xFYXN5SnNvbi5wYXM=]
22
Module=C:\Dev\Delphi\Projects\EasyJson\repo\src\EasyJson.pas
3-
CursorX=3
4-
CursorY=316
5-
TopLine=273
3+
CursorX=1
4+
CursorY=2008
5+
TopLine=1992
66
LeftCol=1
77
Elisions=
88
Bookmarks=
@@ -557,4 +557,44 @@ LeftCol=1
557557
Elisions=
558558
Bookmarks=
559559
EditViewName=C:\Dev\Delphi\Projects\EasyJson\repo\examples\testbed\UTestbed.pas
560+
[ClosedView_QzpcRGV2XERlbHBoaVxQcm9qZWN0c1xFYXN5SnNvblxyZXBvXGV4YW1wbGVzXHRlc3RiZWRcVVRl
561+
c3RiZWQucGFz]
562+
Module=C:\Dev\Delphi\Projects\EasyJson\repo\examples\testbed\UTestbed.pas
563+
CursorX=76
564+
CursorY=776
565+
TopLine=770
566+
LeftCol=1
567+
Elisions=
568+
Bookmarks=
569+
EditViewName=C:\Dev\Delphi\Projects\EasyJson\repo\examples\testbed\UTestbed.pas
570+
[ClosedView_QzpcRGV2XERlbHBoaVxQcm9qZWN0c1xFYXN5SnNvblxyZXBvXGV4YW1wbGVzXHRlc3RiZWRcVVRl
571+
c3RiZWQucGFz]
572+
Module=C:\Dev\Delphi\Projects\EasyJson\repo\examples\testbed\UTestbed.pas
573+
CursorX=39
574+
CursorY=458
575+
TopLine=449
576+
LeftCol=1
577+
Elisions=
578+
Bookmarks=
579+
EditViewName=C:\Dev\Delphi\Projects\EasyJson\repo\examples\testbed\UTestbed.pas
580+
[ClosedView_QzpcRGV2XERlbHBoaVxQcm9qZWN0c1xFYXN5SnNvblxyZXBvXGV4YW1wbGVzXHRlc3RiZWRcVVRl
581+
c3RiZWQucGFz]
582+
Module=C:\Dev\Delphi\Projects\EasyJson\repo\examples\testbed\UTestbed.pas
583+
CursorX=17
584+
CursorY=234
585+
TopLine=13
586+
LeftCol=1
587+
Elisions=
588+
Bookmarks=
589+
EditViewName=C:\Dev\Delphi\Projects\EasyJson\repo\examples\testbed\UTestbed.pas
590+
[ClosedView_QzpcRGV2XERlbHBoaVxQcm9qZWN0c1xFYXN5SnNvblxyZXBvXGV4YW1wbGVzXHRlc3RiZWRcVVRl
591+
c3RiZWQucGFz]
592+
Module=C:\Dev\Delphi\Projects\EasyJson\repo\examples\testbed\UTestbed.pas
593+
CursorX=1
594+
CursorY=896
595+
TopLine=792
596+
LeftCol=1
597+
Elisions=
598+
Bookmarks=
599+
EditViewName=C:\Dev\Delphi\Projects\EasyJson\repo\examples\testbed\UTestbed.pas
560600

0 commit comments

Comments
 (0)