Documentation

Una is developed by Una Technologies Limited

All rights reserved

© 2022 Una Technologies Limited

Print

Displaying Value with Related Key

JsonValue get value using key

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>jsonValue</variable><variable>getKeys</variable></variables><block type=\"Json_JsonValue_get\" disabled=\"true\" x=\"-22\" y=\"652\"><value name=\"jsonValue\"><block type=\"variables_get\" disabled=\"true\"><field name=\"VAR\">jsonValue</field></block></value><value name=\"key\"><shadow type=\"text\" disabled=\"true\"><field name=\"TEXT\"/></shadow></value></block></xml>"}
				
			

This is used to get the value using the object key.

Parameters: Json Value (Object Operation)

Output: Json Value Array

Sample code:

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>jsonValue</variable></variables><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"variables_set\"><field name=\"VAR\">jsonValue</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"Json_parse\"><value name=\"str\"><shadow type=\"text\"><field name=\"TEXT\">{\"name\":\"Hello World\", \"Number\":255}</field></shadow></value></block></value><next><block type=\"basic_consoleLogText\"><value name=\"text\"><block type=\"Json_JsonValue_stringify\"><value name=\"jsonValue\"><block type=\"variables_get\"><field name=\"VAR\">jsonValue</field></block></value></block></value><next><block type=\"basic_consoleLogText\"><value name=\"text\"><block type=\"Json_JsonValue_stringify\"><value name=\"jsonValue\"><block type=\"Json_JsonValue_get\"><value name=\"jsonValue\"><block type=\"variables_get\"><field name=\"VAR\">jsonValue</field></block></value><value name=\"key\"><shadow type=\"text\"><field name=\"TEXT\">name</field></shadow></value></block></value></block></value></block></next></block></next></block></statement></block></xml>"}
				
			

The output:

Get Value Using Key - Ouptut
Previous Showing Keys in String Array Format
Next Finding the Corresponding Key