Thank You :-) Happy Now!!


Don Brown




From: "Jon Paris" <jon.paris@xxxxxxxxxxxxxx>
To: "RPG programming on the IBM i (AS/400 and iSeries)"
<rpg400-l@xxxxxxxxxxxxxxxxxx>
Date: 14/01/2019 02:42 AM
Subject: Re: DATA-INTO Json failing
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx>



You don't need the count - unless the item is optional.

I coded it originally because you had said it was an array and I had not
spotted that it wasn't. When noted that I just didn't think to mention
that if the item is compulsory then neither the num_ field or the Dim()
are needed. If the item is optional then coding it allows you to avoid
having to use allowmissing - which is always a dangerous option.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Jan 12, 2019, at 6:21 PM, Don Brown <DBrown@xxxxxxxxxx> wrote:

Sorry for continuing this discussion but I am still not getting one
thing.

Here is a very simple example using just a part of the json string that
I
am working with.
(Unfortunately this is not just test data - it is from the user
acceptance
testing environment
and represents exactly what we will get in the live environment!!)

Here is the json;

myjson = '{ +
"refresh_token_expires_in" : "0", +
"api_product_list" : "[P2P Rideshare API Product]",
}'

And the data structure that now works for that json string

dcl-ds aaaaa qualified;
refresh_token_expires_in varchar(10);
num_api_product_list int(5) ;
api_product_list varchar(50) dim(5);
...
end-ds;

Why do I need a count ( num_api_product_list int(5) ) for the
"api_product_list"

As you said in your previous response "[P2P Rideshare API Product]" IS

NOT an array
because the square brackets are inside the double quotes.

In case I have oversimplified or by omitting the full json string and/or

data structure i have included
again below.



dcl-ds aaaaa qualified;
refresh_token_expires_in varchar(10);
num_api_product_list int(5) ;
api_product_list varchar(50) dim(5);
num_api_product_list_json int(5) ;
api_product_list_json varchar(50) dim(5);
organization_name varchar(50);
developer_email varchar(50);
token_type varchar(50);
issued_at varchar(20);
client_id varchar(50);
access_token varchar(50);
application_name varchar(50);
scope varchar(50);
expires_in varchar(10);
refresh_count varchar(10);
status varchar(20);
end-ds;

myjson = '{ +
"refresh_token_expires_in" : "0", +
"api_product_list" : "[P2P Rideshare API Product]", +
"api_product_list_json" : [ "P2P Rideshare API Product" ], +
"organization_name" : "onegov", +
"developer.email" : "sam@xxxxxxxxx", +
"token_type" : "BearerToken", +
"issued_at" : "1547071634302", +
"client_id" : "WmTFrOi8ZXBa0RBn6Tx2vYd3dnkOgtjj", +
"access_token" : "ePpNwfSoCUosyHpqQJlcK3zAjHeG", +
"application_name" : "2d8ee44d-5621-459a-8e44-7946c8d319dd", +
"scope" : "", +
"expires_in" : "43199", +
"refresh_count" : "0", +
"status" : "approved" +
}';


Don Brown

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud
service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (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


This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2019 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].