User Manual
Print

Receiving AI Result and Changing It to JsonValue

Get AI result as JsonValue

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>photo</variable><variable>visionAnalysisResult</variable><variable>result</variable></variables><block type=\"UnaAI_AiResult_getContentAsJsonValue\" disabled=\"true\" x=\"113\" y=\"248\"><value name=\"result\"><block type=\"variables_get\" disabled=\"true\"><field name=\"VAR\">result</field></block></value></block></xml>"}
				
			

This is used to get the AI result after AI get the object or face in photo and convert it to JSON value.

Parameters: AI Result (from Azure) 

Output: Json Value
Sample code:

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>photo</variable><variable>visionAnalysisResult</variable><variable>JsonValue</variable><variable>result</variable></variables><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"variables_set\"><field name=\"VAR\">photo</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"Resources_getPhotoByURL\"><value name=\"url\"><shadow type=\"text\"><field name=\"TEXT\">https://www.magicubedu.com/una/AI1/2.jpg</field></shadow></value></block></value><next><block type=\"variables_set\"><field name=\"VAR\">visionAnalysisResult</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"UnaAI_detectObjects\"><value name=\"img\"><block type=\"variables_get\"><field name=\"VAR\">photo</field></block></value></block></value><next><block type=\"variables_set\"><field name=\"VAR\">JsonValue</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"UnaAI_AiResult_getContentAsJsonValue\"><value name=\"result\"><block type=\"variables_get\"><field name=\"VAR\">visionAnalysisResult</field></block></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=\"Camera_showPhoto\"><value name=\"photo\"><block type=\"variables_get\"><field name=\"VAR\">photo</field></block></value></block></next></block></next></block></next></block></next></block></statement></block></xml>"}
				
			

The output:

Get AI Result As JsonValue - Output 1