值作为列表出现.. JMESPath 中的每个单元格需要一个值

问题描述

我有一个嵌套的 json。我想提取以下值 Institute_id,investor_id,consultant_id .我似乎无法正确提取它。请参阅下文。有人可以帮忙吗。

{
   instituition_id : 112,name : 'abc',invest_funds: [
     { 
          investor_id : 20,name: 'fake',consultants:[
             {
                consultant_id: 10,name: 'xyz',consultant_offices: [
                   {
                       consultant_office_id : 1,name: 'jkl',consultant_contants : [
                         {
                            consultant_contact_id: 15,another_id: 211,asset_classes:[
                             {
                               val1: 'abc',val2: 311,val3: 'dfsd',val4: 'fghfhg'
                               },{
                               val1: 'def',val2: 301,val3: 'sedr',val4: 'kugg'
                               },]
                         }
                      ]
                   }
               ]
      },{
         consultant_id: 14,name: 'pqr',consultant_offices: [
      ]
    }
 ]
},{ 
          investor_id : 28,name: 'fake1',consultants:[
             {
                consultant_id: 30,name: 'xyz1',consultant_offices: [
                    
                 ]
              }
          ]
       }
     ]
   }

我正在创建映射。

    {"unnest":true,"path":"invest_funds[?consultants]"},{"name":"institution_id","path":"institution_id","absolute": true},{"name":"investor_id","path":"investor_id"},{"name":"consultant_id","path":"consultants[?consultant_id]"}

我的结果:

institution_id  investor_id consultant_id
112                    20                       [10,14]
112                    28                           [30]  

想要

institution_id  investor_id consultant_id
112                    20                       10
112                    20                       14
112                    28                       30

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)