Hi Vijay, I just took at look because I wasn't sure. I think this isn't possible. But I kinda think we should make it possible somehow via the SchemaBuilder interface and some implementation that would allow this...
Kasper 2016-06-23 9:47 GMT-07:00 Vijay Kumar Jalagari <[email protected]>: > Yes, it will return List of values if I use but 'accounts' but Is it > possible to specify that account is separate table which as one to many > relationship with account. > > Regards, > Vijay Kumar J > > -----Original Message----- > From: Kasper Sørensen [mailto:[email protected]] > Sent: Thursday, June 23, 2016 9:59 PM > To: [email protected] > Subject: Re: [JSON Connector] Multiple Tables and Joining > > Hi Vijay, > > If you want both returned then you shouldn't query for `accounts[0]` but > just `accounts`. The returned object will be lists if I recall correctly. > > Kasper > > 2016-06-22 10:23 GMT-07:00 Vijay Kumar Jalagari <[email protected]>: > > > Hi, > > > > I am trying JSON connector and facing issues while defining the > > multiple table based on below JSON. > > > > { "name": "VJ", > > "age": 29, > > "accounts": [{ > > "type": "Saving", > > "name": "HDFC"}, { > > "type": "Current", > > "name": "SBI"}]} > > > > Use case - Wanted to define two table out of above json with following > > fields > > > > * Employee - name & age > > > > * Accounts - name & type > > > > So that user can fetch either data of employee or account or both > > using joins. I tried below code but it's not working > > > > SimpleTableDef tableDef = new SimpleTableDef("employee", new String[] > > { "name", "age" }); SimpleTableDef accountDef = new > > SimpleTableDef("account", new String[] { "accounts.type", > > "accounts.name" }); SchemaBuilder schemaBuilder = new > > SimpleTableDefSchemaBuilder("myschema", > > tableDef, accountDef); > > dataContext = new JsonDataContext(new > > InMemoryResource("x/y",stringToJSON(),new > > Date().getTime()),schemaBuilder); > > > > Verified the test cases and found the way to create table in combine > > way by using definition[0] but when I say select accounts[0].type from > > employee it only returns Saving instead of getting both Saving & > > Current > > > > > > Can anyone please guide me to create multiple tables for above JSON data > ? > > > > > > > > > > > > > > > > [0] - SimpleTableDef tableDef = new SimpleTableDef("employee", new > > String[] { "name", "age", "accounts[0]", "accounts[0].type", > > "accounts[0].name" }); > > > > > > Regards, > > Vijay Kumar J > > >
