Customer Portal

JsonExtract could not read json starting with array

Comments 3

  • Avatar
    Vladimir Barton
    0
    Comment actions Permalink
    Hi Madan_clover3,
    from looking at the snippet of your JSON input data and the mapping, I am a little bit on the fence as to where the mapping actually came from. From the first glance, I noticed that root element mappings should, in fact, be Mappings (note uppercase M) and the first element should not be json_object but json_array instead. Did you use the visual mapping editor in JSONExtract?
    Attached is a project containing a graph where using the visual mapping editor is used to pull data from both of your JSON snippets. The data gets extracted successfully from both. Please review it and let us know if you have any questions.
    Kind regards,
  • Avatar
    madan_clover3
    0
    Comment actions Permalink
    Hi,

    Thanks for response. After using 'json_array' it is working as expected. Regarding mapping - not used any editor. I am using clover open source engine in my java application, generated mapping using custom code. I could not find any documentation about 'json_array'. Your response is helpful to me. Please suggest if there is any java specific documentation.

    And extraction works with 'mappings' (small m) as well.
  • Avatar
    Vladimir Barton
    0
    Comment actions Permalink
    Hi Madan_clover3,
    whether you should select ‘json_array’ or ‘json_object’ in the mapping depends on the actual input data. In this case, it depends on whether the root element in the JSON structure is an object or an array. This difference is shown in the example I have attached in my previous post (note your 2 types of input data and the mapping definition that together demonstrate the difference between root as json_object and json_array). As for the documentation, this topic is dealt with within the JSONReader component documentation as JSONReader requires manual mapping definition whereas JSONExtract is primarily designed to facilitate visual mapping editing in CloverETL Designer. Worth noting is also that we do not have a Java-specific documentation, however, we do have a CloverETL release-specific documentation:

    Kind regards,

Please sign in to leave a comment.