Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.

...

Get value Version 3 (Java)

Группа действийAction group: JSON

Описание

Действие возвращает значение из JSON по JSONPath

...

Description

The action returns the value from JSON through JSONPath.

Action icon

Параметры действия

...

Action parameters

Input parameters

JSON - JSON для обработкиfor processing.

JSONPath - JSONPath описывает путь до элемента JSON.

Выходные параметры

Значение - Переменная, содержащая значение из JSON. Значение возвращается в виде строки.

...

describes the path to the JSON element.

Output parameters

Value - variable containing value from JSON. The value is returned as a string.

Settings

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
JSONJSON for processingRobin.JSON
Yes
JSONPathJSONPath describes the path to the JSON element. It always starts with a „/“ character. The corresponding keys are listed below. Indexes are used to access array elements (counting starts from 0). For example, the path „/key/1“ indicates that we are trying to access the second element of the array, which is accessible by the key „key“.Robin.String
Yes
Results
ValueVariable containing value from JSON. The value is returned as a string.Robin.Object

Особые условия использования

Отсутствуют.

Пример использования 

Задача



Special conditions

None.

Example of use

Task

Get the lastName element value from a JSON-file Получить значение элемента lastName из JSON файла test.json

Блок кода
titletest.json
linenumberstrue
collapsetrue
{
	"firstname":"Joe",
	"lastname": "Jackson",
	"gender":"male",
	"age": 28,
	"address": {
		"streetAddress": "101",
		"city": "San Diego",
		"state": "CA"
	},
	"phonenumber": [
	{ "type": "home", "number": "9349282382"}
	]
}

...


Solution

Воспользоваться действиями Use the "Open", "Get value" actions

Реализация

Implementation

  1. Assemble a robot scheme with the actions:
    Image Added

  2. Set the Собрать схему робота ,состоящую из действий: 
    Image Removed
    Настроить параметры для действия "Open" action parameters. 


  3. Настроить параметры для действия Set the "Get value" action parameters. 


  4. Нажать на кнопку Click "Старт" в верхней панелиStart" in the top panel.

Результат

Result

The program robot completed successfully. The value of the needed element was obtained.Программный робот отработал успешно. Значение требуемого элемента получено.