× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



If you are comfortable with free format RPG, I actually prefer using YAJLINTO and creating the corresponding nested data structures in RPG.

Just my 2 cents.

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of (WalzCraft) Jerry Forss
Sent: Monday, July 08, 2019 3:22 PM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Consume json - YJAL & SQL

Hi All,

I just got us up to 7.3 TR6 and started playing with Web Services. Fun!!

I am calling a Google API to get driving distances from an origin up to 25 destinations.
The request can return json (preferred) or xml.

This is purely a learning exercise for me. I just want to understand the different methods.
I am not looking for a discussion on which is better.

I have it working for consuming the resulting json with YJAL and XML with xml-into.
Thank you Scott!!!

I am struggling on how to format and receive the json using SQL-Table.
I have done a ton of embedded SQL but first time trying the SQL-Table.

Here is a sample of the json I receive.
There can be up to 25 destinations.
There can be up to 25 origins. I am only sending 1.
There is 1 row for each origin sent. Hence up to 25 rows.

Just not sure how to set up and consume with all the nested arrays.

Thank you for your guidance!!

{
"destination_addresses" : [
"1234 Main St, La Crescent, MN 55947, USA",
"1742 Park Ave, La Crosse, WI 54601, USA",
"1210 S 10th St, La Crosse, WI 54601, USA",
"9876 W 52nd Ave, Onalaska, WI 854650 USA"
],
"origin_addresses" : [ "1500 Old Hickory Dr, La Crescent, MN 55947, USA" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "18.3 mi",
"value" : 29452
},
"duration" : {
"text" : "29 mins",
"value" : 1746
},
"status" : "OK"
},
{
"distance" : {
"text" : "9.5 mi",
"value" : 15308
},
"duration" : {
"text" : "18 mins",
"value" : 1056
},
"status" : "OK"
},
{
"distance" : {
"text" : "3.8 mi",
"value" : 6142
},
"duration" : {
"text" : "9 mins",
"value" : 534
},
"status" : "OK"
},
{
"distance" : {
"text" : "19.3 mi",
"value" : 31032
},
"duration" : {
"text" : "22 mins",
"value" : 1331
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}

Jerry Forss
Information Technology Team
WalzCraft
608-781-6355 EXT 2530
jforss@xxxxxxxxxxxxx




Subject to Change Notice:

WalzCraft reserves the right to improve designs, and to change specifications without notice.

Confidentiality Notice:

This message and any attachments may contain confidential and privileged information that is protected by law. The information contained herein is transmitted for the sole use of the intended recipient(s) and should "only" pertain to "WalzCraft" company matters. If you are not the intended recipient or designated agent of the recipient of such information, you are hereby notified that any use, dissemination, copying or retention of this email or the information contained herein is strictly prohibited and may subject you to penalties under federal and/or state law. If you received this email in error, please notify the sender immediately and permanently delete this email. Thank You

WalzCraft PO Box 1748 La Crosse, WI, 54602-1748 www.walzcraft.com<http://www.walzcraft.com> Phone: 1-800-237-1326
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.