Hi Joao, Looks like you were trying to send email to dev@metamodel incubator instead.
I have forwarded your original email to dev@ list for Apache MetaModel incubating. - Henry On Tue, Nov 11, 2014 at 7:55 AM, Joao Boto <b...@boto.pro> wrote: > i'm trying to understand how to read a complex json file.. > > i started with this json (but will work with a much more complex): > { > "name":{ "first":"Joe", "last":"Sixpack" }, > "gender":"MALE", > "verified":false, > "userImage":"Rm9vYmFyIQ==" > } > > trying to do what Kasper told me on > https://issues.apache.org/jira/browse/METAMODEL-38 > > I wrote the code below, but i can't get "first" and "last" fields.. > > SimpleTableDef custTable = new SimpleTableDef( > "customer", > new String[] {"name.first","name.last","gender","verified","userimage"} > ); > > SchemaBuilder schema = new SimpleTableDefSchemaBuilder("tester", custTable) > ; > JsonDataContext dc = new JsonDataContext(new FileResource(new > File("src/test/resources/datafeed.json")),schema); > Table table = dc.getDefaultSchema().getTableByName("customer"); > Column firstName = table.getColumnByName("name.first"); > Column lastName = table.getColumnByName("name.last"); > Column gender = table.getColumnByName("gender"); > DataSet dataSet = > dc.query().from(table).select(firstName,lastName,gender).execute(); > while (dataSet.next()) { > String sFirstName = (String) dataSet.getRow().getValue(firstName); > String sLastName = (String) dataSet.getRow().getValue(lastName); > String sGender = (String) dataSet.getRow().getValue(gender); > } > > can someone tell me what I'm doing wrong or indicate which way to go? > > thanks > > Best regards --------------------------------------------------------------------- To unsubscribe, e-mail: general-unsubscr...@incubator.apache.org For additional commands, e-mail: general-h...@incubator.apache.org