Hi Sohani, I think the representation which is in the json is correct. If you look at this json message using a tool like [1], You can view that you have 2 elements in the array (of type sObjects). Within those elements, you can have different elements. Adding all 4 elements under the same array is not correct AFAIU.
[1] https://jsonformatter.curiousconcept.com/ On Wed, Mar 23, 2016 at 7:17 PM, Sohani Weerasinghe <soh...@wso2.com> wrote: > Hi All, > > If we consider the below xml, "urn:sObjects" is an array which contains > elements which are not identical. > > First array contains AccountId, FirstName, LastName and the other array > contains Name. > > <urn:create xmlns:urn="urn:enterprise.soap.sforce.com" > xmlns:urn1="urn:sobject.enterprise.soap.sforce.com" xmlns:xsi=" > http://www.w3.org/2001/XMLSchema-instance"> > <urn:sObjects xsi:type="urn1:Contact"> <!--Zero or more > repetitions:--> > <!--You may enter ANY elements at this point--> > <AccountId>001D000000HRzKD</AccountId> > <FirstName>Jane</FirstName> > <LastName>Doe</LastName> > </urn:sObjects> > <urn:sObjects xsi:type="urn1:Account"> > <Name>Acme Rockets, Inc.</Name> > </urn:sObjects> > </urn:create> > > The generated json schema would be as follows > > { > "$Schema":"http://json-schema.org/draft-04/schema#", > "title":"urn:create", > "id":"http://jsonschema.net", > "type":"object", > "properties":{ > "urn:create":{ > "id":"http://jsonschema.net/urn:create", > "type":"object", > "properties":{ > "urn:sObjects":{ > "id":"http://jsonschema.net/urn:create/urn:sObjects", > "type":"array", > "items":[ > { > "id":"http://jsonschema.net/urn:create/urn:sObjects/0 > ", > "type":"object", > "properties":{ > "AccountId":{ > "id":" > http://jsonschema.net/urn:create/urn:sObjects/0/AccountId", > "type":"string" > }, > "@type":{ > "id":" > http://jsonschema.net/urn:create/urn:sObjects/0/@type", > "type":"string" > }, > "FirstName":{ > "id":" > http://jsonschema.net/urn:create/urn:sObjects/0/FirstName", > "type":"string" > }, > "LastName":{ > "id":" > http://jsonschema.net/urn:create/urn:sObjects/0/LastName", > "type":"string" > } > } > }, > { > "id":"http://jsonschema.net/urn:create/urn:sObjects/0 > ", > "type":"object", > "properties":{ > "@type":{ > "id":" > http://jsonschema.net/urn:create/urn:sObjects/0/@type", > "type":"string" > }, > "Name":{ > "id":" > http://jsonschema.net/urn:create/urn:sObjects/0/Name", > "type":"string" > } > } > } > ] > } > } > } > }, > "namespaces":[ > { > "prefix":"urn", > "url":"urn:enterprise.soap.sforce.com" > }, > { > "prefix":"xsi", > "url":"http://www.w3.org/2001/XMLSchema-instance" > }, > { > "prefix":"urn1", > "url":"urn:sobject.enterprise.soap.sforce.com" > } > ] > } > > > I am facing an issue in representing this in the tree view. Are we going > to add all 4 elements ( AccountId, FirstName, LastName and Name) under the > array object? > > Really appreciate your input on this. > > Thanks, > Sohani > Sohani Weerasinghe > Software Engineer > WSO2, Inc: http://wso2.com > > Mobile : +94 716439774 > Blog :http://christinetechtips.blogspot.com/ > Twitter : https://twitter.com/sohanichristine > -- Thank you and Best Regards, Chanaka Fernando Senior Technical Lead WSO2, Inc.; http://wso2.com lean.enterprise.middleware mobile: +94 773337238 Blog : http://soatutorials.blogspot.com LinkedIn:http://www.linkedin.com/pub/chanaka-fernando/19/a20/5b0 Twitter:https://twitter.com/chanakaudaya
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev