JsonUtil Object
Description
The object used to access JSON objects.
Methods
Parse | Parses a JSON file or JSON content. |
Parse Method
Description
Parses a JSON file or JSON content.
Syntax
JsonUtil.Parse(JsonFile)
Argument | Type | Description |
---|---|---|
JsonFilePath | String | An absolute path to a JSON file or the actual file content. |
IMPORTANT
This method can only be used in GUI tests.
The following example parses the JSON file ImageSettings.json and retrieves values from it.
Set Dom = JsonUtil.Parse("C:\Users\_ft_auto\Desktop\ImageSettings.json")
Print Dom.GetObject("Image").GetValue("Width")
Print Dom.GetObject("Image").GetValue("Height")
Print Dom.GetObject("Image").GetValue("Title")
For Each i In Dom.GetObject("Image").GetArray("IDs")
Print i
Next
You can replace the file path in the preceding example with the actual file content, and get the same result.
Set Dom = JsonUtil.Parse("{""Image"":{""Width"": 800, ""Height"": 600, ""Title"": ""View from the 15th floor"", ""IDs"": [116, 943, 234]}}")
Print Dom.GetObject("Image").GetValue("Width")
Print Dom.GetObject("Image").GetValue("Height")
Print Dom.GetObject("Image").GetValue("Title")
For Each i In Dom.GetObject("Image").GetArray("IDs")
Print i
Next
See also:
- Crypt Object
- DataTable Object
- Description Object
- DeviceReplay Object
- DotNetFactory Object
- DTParameter Object
- DTSheet Object
- Environment Object
- Extern Object
- Parameter Object
- JSON Object
- JsonUtil Object
- MercuryTimers Object (Collection)
- MercuryTimer Object
- NV Object
- OptionalStep Object
- ParallelUtil Object
- LocalParameter Object
- PasswordUtil Object
- PathFinder Object
- PDFUtil Object
- Properties Object (Collection)
- QCUtil Object
- RandomNumber Object
- Recovery Object
- Remote Connection Object
- Reporter Object
- RepositoriesCollection Object
- Repository Object
- Services Object
- Setting Object
- SystemMonitor Object
- TestArgs Object
- TextUtil Object
- UIAutomation Object
- VisualRelation Object
- VisualRelations Object
- VisualRelationsCollection Object
- WebUtil Object
- XMLUtil Object