​private anytype traversePath(str path, Newtonsoft.Json.Linq.JContainer obj = jObject){ List pathElements; ListEnumerator le; Newtonsoft.Json.Linq.JValue value; Newtonsoft.Json.Linq.JToken token; Newtonsoft.Json.Linq.JTokenType thisType, nestedType; Newtonsoft.Json.Linq.JObject newObject; Newtonsoft.Json.Linq.JArray newArray; str current, thisTypeString, nestedTypeString; #define.JObject(/Newtonsoft.Json.Linq.JObject/) #define.JArray (/Newtonsoft.Json.Linq.JArray/) ; pathElements = strSplit(path, @/.////); le = pathElements.getEnumerator(); if (le.moveNext()) { current = le.current(); thisType = obj.GetType(); thisTypeString = thisType.ToString(); switch (thisTypeString) { case #JObject: token = obj.get_Item(current); break; case #JArray: token = obj.get_Item(str2int(current) - 1); break; default: return null; } if (token) { nestedType = token.GetType(); nestedTypeString = nestedType.ToString(); if (nestedTypeString != #JObject && nestedTypeString != #JArray) { switch (thisTypeString) { case #JArray: return obj.get_Item(str2int(current) - 1); case #JObject: return obj.get_Item(current); default: return null; } } switch (nestedTypeString) { case #JObject: newObject = Newtonsoft.Json.Linq.JObject::FromObject(token); return this.traversePath(strDel(path, 1, strLen(current) + 1), newObject); case #JArray: newArray = Newtonsoft.Json.Linq.JArray::FromObject(token); return this.traversePath(strDel(path, 1, strLen(current) + 1), newArray); default: return null; } } else { return null; } } else { return null; }}​
Hi Martin,I am using AX 2012.
jObject = Newtonsoft.Json.Linq.JObject::Parse(_json); // _json is a string.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Andrés Arias as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CA Neeraj Kumar 1,019
André Arnaud de Cal... 844 Super User 2025 Season 2
Sohaib Cheema 840 User Group Leader