meta data for this page
JSON example
execute ibeblock as begin SimpleJsonData = '{ "FirstObject" : { "IntValue" : 123456, "StringValue" : "First line" }, "SecondObject" : { "IntValue" : 654321, "StringValue" : "First line\nSecond line\nThird line" }, "ThirdObject" : { "NumValue" : 123.456, "Items" : [ 123, 123.123, null, "some \"string\"", false ] } }'; JsonRoot = ibec_json_Parse(SimpleJsonData); try Node = ibec_json_SelectNode(JsonRoot, 'SecondObject\StringValue', 0); -- case sensitive search if (Node is not null) then begin v = ibec_json_GetNodeValue(Node, TRUE); ibec_ShowMessage(v); end; -- Iterating arrays, using Json namespace functions and constants sOut = 'List of array values:' + ibec_CRLF() + '======================================'; ArrayNode = @Json.SelectNode(JsonRoot, 'thirdobject\items', @Json.SEARCH_IGNORE_CASE); -- case insensitive search if (ArrayNode is not null) then begin NodeType = @Json.NodeType(ArrayNode); if (NodeType = @Json.TYPE_ARRAY) then begin iCount = @Json.ChildCount(ArrayNode); for i = 0 to (iCount - 1) do begin ChildNode = @Json.SelectNode(ArrayNode, i, @Json.SEARCH_BY_INDEX); vValue = @Json.GetNodeValue(ChildNode, TRUE); s = ibec_IIF(vValue is null, '<NULL>', ibec_Cast(vValue, __typeString)); sOut .= ibec_CRLF() + 'Value ' + ibec_Cast(i, __typeString) + ': ' + s; end; ibec_ShowMessage(sOut); end; end; finally ibec_json_Free(JsonRoot); end end