添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
开朗的茄子  ·  tableau API如何访问 | ...·  19 小时前    · 
绅士的熊猫  ·  获取Token - NG-ALAIN·  1 周前    · 
好帅的领带  ·  web元件库 ...·  2 月前    · 
英姿勃勃的警车  ·  android ...·  2 月前    · 
害羞的咖啡豆  ·  Search·  2 月前    · 
近视的砖头  ·  Study of the ...·  3 月前    · 
Hi Users,
I am trying to parse the JSON using Below link:
I copied the Newtonsoft.Json.dll into client and server bin folder, also added reference in AOT.
Parsing of JSON works fine in simple job running, but not working in Batch Job.
Getting below error:
on the line number 50 in the code below.
​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;    }}​
If you know anything about the issue, Plese reply.
Thank you,
Raj Borad
OK, I see. GetType() returns System.Type, but you're trying to assign it to a variable of type Newtonsoft.Json.Linq.JTokenType, which isn't possible. I think you mean Type property, which you can access by get_Type() method. GetType() has a similar name, but it's something completely different. It's a method inherited from System.Object that gives you an instance of System.Type describing the type of the object in the variable.
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;
return null;
return null;

Subscribe to

Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.