Method: WriteFile for JsonParser
- Updated2024-09-12
- 1 minute(s) read
Methods > Method: WriteFile for JsonParser
Method: WriteFile for JsonParser
Saves a text to an UTF-8 file.
Object.WriteFile(String, Filename)
| Object | JsonParser Object with this method |
| String | String Specifies the text. |
| Filename | String Specifies the name and the path of the JSON file. |
The following example creates a JSON object from a dictionary object containing an array and a time value in the items. The example saves the JSON object in a UTF-8 file and displays the path in the log area:
| VBScript | Python |
Dim oJsonParser, oMyMainObject, sJsonString Set oJsonParser = CreateJsonParser() Set oMyMainObject = CreateObject("Scripting.Dictionary") Call oMyMainObject.Add("array", Array("TextB", 5678, True)) Call oMyMainObject.Add("timestamp", oJsonParser.CreateDateTime(Now, True)) sJsonString = oJsonParser.Serialize(oMyMainObject, True) Call oJsonParser.WriteFile(sJsonString, DataWritePath & "JsonObject.json") Call LogfileWrite(DataWritePath & "JsonObject.json")
See Also
Related Topics
Command: ExecuteExclusiveBegin | Command: ExecuteExclusiveEnd | Command: ExecuteExclusiveEndAll