• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » tFileInputJSON - How do I get the data out of the second level?

#1 2012-06-29 01:52:01

talendtester
Member
Registered: 2009-07-15
Posts: 99

tFileInputJSON - How do I get the data out of the second level?

I am able to pull the data for the field OBJECTID by doing "$..OBJECTID" in the JSONPath query in my tFileInputJSON component.

I need help getting the data for the x and y fields. What should the JSONPath query be to get the x and y data?

Here is what my small test file looks like:
{
  "displayFieldName": "FM_NAME",
  "fieldAliases": {
    "OBJECTID": "OBJECTID",
  },
  "geometryType": "esriGeometryPoint",
  "spatialReference": {"wkid": 1000},
  "features": [
    {
      "attributes": {
        "OBJECTID": 100,
      },
      "geometry": {
        "x": -27.99,
        "y": 67.33
      }
    }
  ]
}


The job runs and gives an error message of:
Can't find any data with JSONPath $...X
Can't find any data with JSONPath $...Y


I found this post, it looks like it hasn't been resolved, so that is why it is not working for me?
http://jira.talendforge.org/browse/TDI-17306

Offline

#2 2012-06-29 04:08:59

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: tFileInputJSON - How do I get the data out of the second level?

Hi

Try these two JSONPath.
"$.features[*]..x"
"$.features[*]..y"

Regards,
Pedro


Uploaded Images


Only Paranoid Survive.

Offline

#3 2012-06-29 17:03:57

talendtester
Member
Registered: 2009-07-15
Posts: 99

Re: tFileInputJSON - How do I get the data out of the second level?

Thanks Pedro!

It gives me the right output now.

Do you know why it gives me these messages?

The Json resource datas maybe have some problems, please make sure the data structure with the same fields.
The Json resource datas maybe have some problems, please make sure the data structure with the same fields.

Offline

#4 2012-07-02 09:00:56

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: tFileInputJSON - How do I get the data out of the second level?

Hi

Please show me the settings of tFileInputJSON. I didn't get this info.

Regards,
Pedro


Only Paranoid Survive.

Offline

#5 2012-07-02 18:50:06

talendtester
Member
Registered: 2009-07-15
Posts: 99

Re: tFileInputJSON - How do I get the data out of the second level?

Property Type: Built-In
Schema: Built-In
Filename: C:/folderName/fileName.txt

Column                               JSONPath query
----------------------------------------------
OBJECTID                           "$..OBJECTID"
X                                       "$.features[*]..x"
Y                                       "$.features[*]..y"



Nothing is in the Advanced Settings section.


The schema is:
OBJECTID                           String 3
X                                       String 20
Y                                       String 19

Last edited by talendtester (2012-07-02 18:51:55)

Offline

#6 2012-07-03 05:25:10

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: tFileInputJSON - How do I get the data out of the second level?

Hi

This is because in your json file there are two OBJECTIDs.
"OBJECTID": "OBJECTID"
"OBJECTID": 100

Use this jsonpath: "$.features[*]..OBJECTID".

Regards,
Pedro


Only Paranoid Survive.

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » tFileInputJSON - How do I get the data out of the second level?

Board footer

Powered by FluxBB