No Data :(

Mar 12, 2015 at 6:35 PM
Hi Alberto,

The component is installed and I'm attempting to use it. However, when I put in the following Web URL: https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=<apikey> I get the following data returned
{
{
    results: [
        {
            address_components: [
            {
                long_name: "1600",
                short_name: "1600",
                types: [
                    "street_number"
                ]
            },
            {
                long_name: "Amphitheatre Parkway",
                short_name: "Amphitheatre Pkwy",
                types: [
                    "route"
                ]
            },
            {
                long_name: "Mountain View",
                short_name: "Mountain View",
                types: [
                    "locality",
                    "political"
                ]
            },
            {
                long_name: "Santa Clara County",
                short_name: "Santa Clara County",
                types: [
                    "administrative_area_level_2",
                    "political"
                ]
        },
What do I need to do in order to actually have this data returned via the component?

Under Input-Output I have long_name and short_name fields defined. Under the Advanced tab my JSON Array Path is "results.address_components". What am I missing?

Thanks,

Michael
Mar 12, 2015 at 6:43 PM
Here are the error messages:
Error: 0x64 at Data Flow Task, JSON Source Component: Cannot find an array to the object path specified: results.address_components. Please check the path.
Error: 0x3E8 at Data Flow Task, JSON Source Component: An error has occurred: Cannot find an array to the object path specified: results.address_components. Please check the path.. 
   at com.webkingsoft.JSONSource_110.JSONSourceComponent.ProcessInMemory(StreamReader _sr, PipelineBuffer buffer)
   at com.webkingsoft.JSONSource_110.JSONSourceComponent.PrimeOutput(Int32 outputs, Int32[] outputIDs, PipelineBuffer[] buffers)
Coordinator
Mar 12, 2015 at 8:09 PM
Edited Mar 12, 2015 at 8:13 PM
Hi Michael,

I see where the problem is. Let me explain why this is failing and how you may work around this error.
JSONSource is a simple component which parses JSON structures arrays. Each element of an array is then parsed against the Input-Output configuration you define. So, given an array of all well-formatted elements, this is pretty simple: walk to the branch containing the array to parse and, for each object, parse the results. So, the elements contained into the array must match the same schema, i.e. every json object must contain same parameters of the same type.

Have a look to the structure of the returned object. You've specified, as path to the result array, a wrong one. "Address_components" is an element of the results array!

So, json path would be: results[0].address_components

However, this notation isn't supported. When you need to take sub-branches of json objects, you need to use the powerful newtonsoft library, which requires to load all the JSON into a memory data struct. This consumes more memory, but since you are basically requesting few rows, it would be perfectly OK.

So, the path would be simply: $.results[0].address_components

Look at the screenshots over here to see how I ran your component:
Image
Image
Image

NOTE: I've selected the High Performance Mode!

Try and let me know if you solve this problem!
Marked as answer by webking on 3/12/2015 at 4:33 PM
Mar 17, 2015 at 12:48 PM
Excellent! Everything is working great. I will continue playing with the component and path's to see how well it works for our internal stuff here.

Thanks again for all your help and quick responses.

Regards,

Michael Murray