asd435658185
asd435658185
2016-06-15 06:47

kettle JSON INPUT解析JSON字符串

各位大大 ,在使用kettle的JSON INPUT解析JSON字符串的时候碰到一个问题
我有一个JSON字符串
{"errorCode":"0","realName":"张小明","schoolId":13068,"schoolName":"四五二小学",
"teachClasses":[{"className":"三年级3班","classRole":"0","croName":"小学","croid":3,"gradeId":6,"gradeName":"三年级","id":31105,"[b]teachSubjects[/b]":[{"id":4,"subjectName":"数学"}]},
{"className":"四年级4班","classRole":"1","croName":"小学","croid":3,"gradeId":7,"gradeName":"四年级","id":31106}],"uid":1003147629,"uuid":"T0000001003147629"}

因为这个JSON串中teachClasses也是一个JSON串,所以需要做2次解析,但是在这个teachClasses字符串中,teachSubjects有可能不存在,那么我在使用JSON INPUT工具解析时候,
图片说明
运行时就会报错,提示
The data structure is not the same inside the resource! We found 1 values for json path [$..teachSubjects], which is different that the number retourned for path $..className. We MUST have the same number of values for all paths.
有没有哪位大神救命呀 在线等。急急急急。

还有一个问题,当teachSubjects存在的时候,里面标识符也是写id跟外层id重复,一样会报错,提示信息跟上面一样。

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答