×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Hello Peter,

I've updated my website here:  https://www.scottklement.com/yajl/

If you download the latest version of YAJL for IBM i 7.1+, it now has a subprocedure called yajl_get_bignumber() that will return a packed(63:20) -- so more than the 15 decimal places you asked for.  Simply change your code to call yajl_get_bignumber() in place of yajl_get_number() and you'll have the full precision.

Good luck!

-SK

On 10/19/2022 1:44 PM, Scott Klement wrote:
Hi Peter,

Currently yajl_get_number() converts numbers to packed(30: 9) fields.  At the time I first ported YAJL to the system (more than 10 years ago now) I still had to support V5R3, which could only support 30 digit numbers, so this seemed like a good compromise.

Perhaps I could add a new subprocedure that does the same thing but returns a larger size such as packed(63: 15).

-SK


On 10/19/2022 8:14 AM, Peter Colpaert 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


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