Hello all,
I have an application which looks up currency exchange rates from www.openexchangerates.org. This returns a list of currencies in a JSON format.
In my xbasic function which retrieves the data, I have the following
This gives me data which looks like this:
I want to take this data and update a MySQL table with fields for "UNITS" and "RATE".
But I am at a loss as to how to gracefully get this data out and update a table.
The following works to let me see the rate data as result_p.rates :
But I cannot figure out how to iterate through that information to create an update SQL statement.
If anyone can give me some suggestions how to do this, I would be most appreciative.
Thanks in advance...
I have an application which looks up currency exchange rates from www.openexchangerates.org. This returns a list of currencies in a JSON format.
In my xbasic function which retrieves the data, I have the following
Code:
dim url as c dim result_p as p url="http://openexchangerates.org/api/latest.json?app_id=xxxxxxxxxxxxxxxxxxxxxxxx" data = http_get(url)
Code:
{ "disclaimer": "Exchange rates are provided for informational purposes only, and do not constitute financial advice of any kind. Although every attempt is made to ensure quality, NO guarantees are given whatsoever of accuracy, validity, availability, or fitness for any purpose - please use at your own risk. All usage is subject to your acceptance of the Terms and Conditions of Service, available at: https://openexchangerates.org/terms/", "license": "Data sourced from various providers with public-facing APIs; copyright may apply; resale is prohibited; no warranties given of any kind. Bitcoin data provided by http://coindesk.com. All usage is subject to your acceptance of the License Agreement available at: https://openexchangerates.org/license/", "timestamp": 1404277244, "base": "USD", "rates": { "AED": 3.673012, "AFN": 57.3156, "ALL": 102.5156, . . . "ZAR": 10.66216, "ZMK": 5252.024745, "ZMW": 6.267228, "ZWL": 322.355006 } }
But I am at a loss as to how to gracefully get this data out and update a table.
The following works to let me see the rate data as result_p.rates :
Code:
result_p = json_parse(data.body)
If anyone can give me some suggestions how to do this, I would be most appreciative.
Thanks in advance...
Comment