{
"Id": 456,
"Type": null,
"Name": "Store112",
"Root": "\\\\server\\ShareFolder",
"Username": "alm",
"Password": null
}
This is a JSON file response body from a HTTP Request, how can I get the value of 'ID' property? Does UFT or QTP has a function to support this?
In order to use a specific JSON property from the response you should do the following.
JSON
from the drop down listThen in the activity you want to use the value, click the link icon for the input parameter, select the HTTP tab and select the
Id
property from the Output section.With QTP10 it is not possible to do this natively, but depending on how much data you want from the JSON file (only ID or do you want to parse the whole thing) and how complicated the JSON file is (multiple childs objects etc.) you can use the following tactics:
id = ImportedObject.ID
""ID"": *([^,]*)
on the response body.I would opt for 3 unless you want to get much more information from the JSON file.