Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
titleJSON
{
	"isSuccessful": true,
	"statusMessage" : "Successful retrieval",
	"data": {
		"lastUpdated": "2015-07-11 22:34:16",
		"contacts": [
			{
				"name": "Joe Dow",
				"phone": "+4412341234",
				"subscriptions": ["Science", "Engineering", "IT", "Finance"],
				"age": 37			
			},
			{
				"name": "Jane Dow",
				"phone": "+4412351235",
				"subscriptions": ["Media", "Movies", "Finance", "Politics"]				
			}
		]
	}
}

...

Example 2

The following JSON object array contains just a list of contacts:

...

The following Locators retrieve data from the JSON object array above:

LocatorData ValueExplanation
[0].name"Joe Dow"The value of the name property of the first element in the root array.
[1].subscriptions[0]"Media"The value of the second member of the subscriptions array, property of the second member of the root array.

...

Info

Locators pointing to non-existing object properties or array members will retrieve null during value during an interaction without any indication of a failure, thus allowing any expected value to be optional.

Locators pointing to a JSON object or a JSON array rather than a simple data type value will retrieve the whole object or array and allow saving it as plain text.

...