Hi Godwin,

In this use case, JSON schema generator will consider all the datatypes,
but it will get the datatype of the last value of the array. See the below
JSON representation of the XML

{
   "employees":{
      "firstname":"Demo",
      "lastname":"Demo",
      "addresses":{
         "address":[
            {
               "add1":"No 827/B",
               "add2":"Gemunu Mawatha"
            },
            {
               "add1":321,
               "add2":"Mount Lavinia"
            }
         ]
      }
   }
}

Since the datatype of last "add1" is a NUMBER it will take that for the
JSON schema. Hence we see it in the graphical tree.

Issue is we have to select one of the datatypes among all the datatypes for
the schema. Currently the convention is to get the last datatype. But as a
fix, we can set high priority to STRING when we have to select one from
multiple datatypes.

Until we figure out that conventional issue, you can change the datatype of
"add1" from the graphical view. Right click on the "add1" element from the
tree --> Click "Edit Field" and then change the Schema type.

Thanks,
Viraj.

On Tue, Jul 19, 2016 at 9:02 AM, Nuwan Pallewela <[email protected]> wrote:

> Adding Sohani
>
> On Tue, Jul 19, 2016 at 12:42 AM, Godwin Shrimal <[email protected]> wrote:
>
>> Hi All,
>>
>> When load following xml file in to data mapper (input/output), the add1
>> data type takes as NUMBER as in screenshot . It looks when there is at
>> least one record in the array with NUMBER it takes as NUMBER. I think It
>> should consider all the values in the array.
>>
>> <employees>
>> <firstname>Demo</firstname>
>>         <lastname>Demo</lastname>
>>
>> <addresses>
>>           <address>
>>   *<add1>No 827/B</add1>*
>>             <add2>Gemunu Mawatha</add2>
>>           </address>
>>           <address>
>>             *<add1>321</add1>*
>>             <add2>Mount Lavinia</add2>
>>           </address>
>>         </addresses>
>> </employees>
>>
>> [image: Inline image 2]
>> Thanks
>> Godwin
>>
>> --
>> *Godwin Amila Shrimal*
>> Senior Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: *+94772264165*
>> linkedin: *http://lnkd.in/KUum6D <http://lnkd.in/KUum6D>*
>> twitter: https://twitter.com/godwinamila
>> <http://wso2.com/signature>
>>
>
>
>
> --
> ----------------------------------------------------------
>
> *Nuwan Chamara Pallewela*
>
>
> *Software Engineer*
>
> *WSO2, Inc. *http://wso2.com
> *lean . enterprise . middleware*
>
> Email   *[email protected] <[email protected]>*
> Mobile  *+94719079739 <%2B94719079739>@*
>
>
>


-- 
Viraj Rajaguru
Associate Technical Lead
WSO2 Inc. : http://wso2.com

Mobile: +94 77 3683068
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to