Read JSON Object

shanabeywicremashanabeywicrema Member Posts: 53
edited 2022-07-06 in NAV Three Tier
Can we extract Object (nested Object) name from this kind of JSON? I am able to count how many objects are in the json, but cannot extract value. ("27675","27676") I am using Newtonsoft

"27675":{
"entity_id":"27675",
"status":"complete",
"coupon_code":null,
"shipping_descript
},
"27676":{
"entity_id":"27676",
"status":"complete",
"coupon_code":null,
"shipping_descript
}

Comments

  • shanabeywicremashanabeywicrema Member Posts: 53
    This is how my code.

    APIResult := JsonConvert.SerializeObject(result);
    APIResult := JsonConvert.DeserializeObject(APIResult,GETDOTNETTYPE(APIResult));
    JProperties := JObject1.Parse(APIResult);

    FOR i := 0 TO JObject1.Count DO BEGIN

    END;
  • AlexDenAlexDen Member Posts: 85
    Hi,

    Below is an example, how to get list of properties of JsonObject:
    PROCEDURE ReadJsonString(JsonText : Text);
        VAR
          JObject : DotNet "'Newtonsoft.Json'.Newtonsoft.Json.Linq.JObject";
          JProperty : DotNet "'Newtonsoft.Json'.Newtonsoft.Json.Linq.JProperty";
          IEnumerable : DotNet "'mscorlib'.System.Collections.Generic.IEnumerable`1";
          IEnumerator : DotNet "'mscorlib'.System.Collections.Generic.IEnumerator`1";
        BEGIN
          JObject := JObject.Parse(JsonText);
    
          IF NOT JObject.HasValues THEN
            EXIT;
    
          IEnumerable := JObject.Properties;
          IEnumerator := IEnumerable.GetEnumerator;
    
          WHILE IEnumerator.MoveNext DO BEGIN
    
            JProperty := IEnumerator.Current;
            IF ISNULL(JProperty) THEN
              EXIT;
    
            MESSAGE('Name: %1\Value: %2', JProperty.Name, JProperty.Value);
          END;
        END;
    
  • surbhinahtasurbhinahta Member Posts: 1
    Used to analyze two JAVA boolean articulations and return bogus on the off chance that both the boolean articulations are misleading, or, in all likelihood it returns valid assuming any of the boolean articulation is valid. A boolean articulation is an articulation that outcomes in a boolean worth - valid or bogus.

Sign In or Register to comment.