× 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.



continuing...

The performance turned out to be something like 10 times faster than YAJL.
After calling the parse() procedure you might code something like:

latitude = %float(jsnGetVal('/Lat_WGS84'));



On Wed, Oct 19, 2022 at 4:45 PM Nathan Andelin <nandelin@xxxxxxxxx> wrote:

Peter,

Looks like Scott provided a solution. With the JSON parser I wrote, I felt
that the API would be much simpler if I had only 1 procedure return node
values as VARCHAR type, and let the RPG programmer use %float(), %dec(),
%int(), etc. to transform it to the appropriate data type. As a bonus, it
turned out that it performed something like 1

On Wed, Oct 19, 2022 at 7:14 AM Peter Colpaert <peter.colpaert@xxxxxxxxx>
wrote:

Hi group,

I've been tasked with refactoring some API calls from our system to
various
websites and am implementing Scott Klement's excellent YAJLR4 service
program (thanks Scott!)

However, I'm a bit at a loss as to how I can extract coordinates from a
JSON file I receive.

More specifically, the latitude and longitude are represented as follows:

"Location": {
"Lat_WGS84": 51.17456057389046,
"Lon_WGS84": 4.3991863572532086,
"X_Lambert72": 152128.06,
"Y_Lambert72": 207173.33
}

I can successfully find the Lat_WGS84 and Lon_WGS84 nodes, but I cannot
retrieve the full coordinates.

If I use yajl_get_string, it returns nothing (of course), but
yajl_get_number is truncated to 9 decimals whereas I need 14.

I could of course treat the JSON response as a string and simply scan for
the first occurrence of "Location", but that would defeat the purpose of
having YAJL available.

Any suggestions?

Thanks in advance.

Peter

--

Peter Colpaert

Peter.Colpaert@xxxxxxxxx
--
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@xxxxxxxxxxxxxxxxxxxx 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.