JsonExtract could not read second record of root array

Discussion on developing CloverDX engine, transformation components etc.

madan_clover3
Posts: 24
Joined: Tue Jun 10, 2014 10:39 am

JsonExtract could not read second record of root array

Postby madan_clover3 » Thu Jan 31, 2019 10:42 am

Hi,

JsonExtract is not able to read second record of root array element. Below is data and extraction mapping,

Data :

Code: Select all

[{
  "id": "1",
  "name": "emp1"
},{
  "id": "2",
  "name": "emp2"
}]


Extraction Mapping :

Code: Select all

<Mappings>
  <Mapping element="json_array" outPort="0" xmlFields="{}id;{}name" cloverFields="id;name"/>
</Mappings>


JsonExtract is producing only first record, second one is missing. Please suggest if I am missing any configuration. It its a bug any work around ?

bartonv
Posts: 125
Joined: Wed May 03, 2017 12:10 pm

Re: JsonExtract could not read second record of root array

Postby bartonv » Fri Feb 08, 2019 3:42 pm

Hello,
in order to extract both fields from the array, try using this mapping:

Code: Select all

<Mappings>
   <Mapping element="json_array">
      <Mapping element="json_array" outPort="0"
            xmlFields="{}id;{}name"
            cloverFields="id;name">
      </Mapping>
   </Mapping>
</Mappings>

Attached is a graph where this is demonstrated.
Best,
Attachments
JSONExtract.grf
(1.21 KiB) Downloaded 26 times
---
Vladimir Barton
CloverCARE Support
CloverDX

Visit us online at http://www.cloverdx.com

madan_clover3
Posts: 24
Joined: Tue Jun 10, 2014 10:39 am

Re: JsonExtract could not read second record of root array

Postby madan_clover3 » Wed Feb 13, 2019 8:13 am

Thank you. With the above changes working as expected.


cron