A good example is when I call the googlemaps API to convert an address to a lat / long pair.
When I make the following call: https://maps.googleapis.com/maps/api/geocode/json?address=8439 SW 88th CT Ocala FL
I get the following results:
{
"results" : [
{
"address_components" : [
{
"long_name" : "8439",
"short_name" : "8439",
"types" : [ "street_number" ]
},
{
"long_name" : "Southwest 88th Court",
"short_name" : "SW 88th Ct",
"types" : [ "route" ]
},
{
"long_name" : "Ocala",
"short_name" : "Ocala",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Marion County",
"short_name" : "Marion County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Florida",
"short_name" : "FL",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
},
{
"long_name" : "34481",
"short_name" : "34481",
"types" : [ "postal_code" ]
},
{
"long_name" : "8917",
"short_name" : "8917",
"types" : [ "postal_code_suffix" ]
}
],
"formatted_address" : "8439 SW 88th Ct, Ocala, FL 34481, USA",
"geometry" : {
"location" : {
"lat" : 29.0773262,
"lng" : -82.26593099999999
},
"location_type" : "RANGE_INTERPOLATED",
"viewport" : {
"northeast" : {
"lat" : 29.0786751802915,
"lng" : -82.2645820197085
},
"southwest" : {
"lat" : 29.0759772197085,
"lng" : -82.26727998029151
}
}
},
"place_id" : "EiU4NDM5IFNXIDg4dGggQ3QsIE9jYWxhLCBGTCAzNDQ4MSwgVVNBIhsSGQoUChIJe6EI-xh56IgRgRSos57hFRIQ90E",
"types" : [ "street_address" ]
}
],
"status" : "OK"
}
What I need is results[0].geometry.location.lat and results[0].geometry.location.long
This is just ONE of the many calls I make, each with very different JSON results. If I could define an attribute as JSON and load this results into it. Then I could easily access it by a function. Assuming I made a REST call and had the results returned to OBJ.results, then I can update my primative lat / long attributes with a simple function call. i.e. Obj.lat = GET_JSON(obj.results, '[0].geometry.location.lat')
This is a LOT easier than creating multiple virtual tables to hold the JSON return. With your current implementation, it is not easy to see the nestling of the tables.
How about if you embrace JSON as a primitive attribute type? Does this make sense?
Bruce