Options

Json reading array using JSON Management, Variant value to loop throw the values arrey 1 to 10?

spencer_graham@hotmail.comspencer_graham@hotmail.com Member Posts: 11
edited 2023-11-13 in NAV Three Tier
{
"enum": [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
]
}

Hello every one¨need your help please :-)

Json reading array using JSON Management, Variant value to loop throw the values arrey 1 to 10?

gJSONMgt.InitializeObject(TempBlob.ReadAsText(CRLF,TEXTENCODING::UTF8));
gJSONMgt.GetJSONObject(gJsonObject);
gJSONMgt.GetArrayPropertyValueFromJObjectByName(gJsonObject,'enum',gJsonArray);
gJSONMgt.InitializeCollectionFromJArray(gJsonArray); //declare collection

FOR Index := 1 TO gJsonArray.Count DO BEGIN
gJSONMgt.GetJObjectFromCollectionByIndex(JCustObject, Index-1); //"extract" a single JObject from the collection

// *** I dont know what to do here.


IF NOT CONFIRM('AliasName = ' + FORMAT(value)) THEN
ERROR('Help');
END;

Answers

  • Options
    Replaced *** I dont know what to do here. --> with value := gJsonObject.SelectToken(STRSUBSTNO('enum.[%1]', Index));
Sign In or Register to comment.