Skip to content

Commit efecba6

Browse files
committed
guide about files
1 parent dba4cae commit efecba6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

GUIDE.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,15 @@ To access the internal sorted list of keys, use the `JSONEnumSorted` function. I
239239

240240
## Loading/saving JSON from/to file
241241

242-
...
242+
_jsonDoc_ itself doesn't have specific functions to load JSON data from files, or store JSON data into files. You're free to use the many options available to you. For example, the unit `System.IOUtils` declares class procedures `TFile.ReadAllText` and `TFile.WriteAllText`. For maximal interoperability, it's advised to use UTF8 to store JSON files.
243+
244+
var
245+
d:IJSONDocument;
246+
begin
247+
d:=JSON(TFile.ReadAllText('demo1.json'));
248+
d['x']:=true;
249+
TFile.WriteAllText('demo2.json',d.AsString,TEncoding.UTF8);
250+
end;
243251

244252
## UseIJSONArray, UseIJSONDocArray
245253

0 commit comments

Comments
 (0)