DATA-INTO operation does not match the RPG Variable reason code 5: the document contains extra names that do not match subfields.
This is the response I am getting:
'{"response": {"token": "eyJraWQiOiJ4UGZncERvQTVQNHBiZU1jSFNH'
'Q2JtbkRVY3l2bjlqSFwvYUJROVc5RFlnUT0iLCJhbGciOiJSUzI1NiJ9.eyJ'
'zdWIiOiI3bHFraHYzdDZnZGJkam5oMjBzaHA5ZDV2biIsInRva2VuX3VzZSI'
'6ImFjY2VzcyIsInNjb3BlIjoiZnBnbG9iYWxzc29fanVzdHJpZ2h0X3NlcnZ'
'lcl9pZGVudGlmaWVyXC90b2tlbi5yZWFkIiwiYXV0aF90aW1lIjoxNzI2MTU'
'1OTgyLCJpc3MiOiJodHRwczpcL1wvY29nbml0by1pZHAudXMtZWFzdC0xLmF'
'tYXpvbmF3cy5jb21cL3VzLWVhc3QtMV9MNHBpTTZwdnEiLCJleHAiOjE3MjY'
'xNTYyODIsImlhdCI6MTcyNjE1NTk4MiwidmVyc2lvbiI6MiwianRpIjoiODA'
'zYzAwZDQtNGY1OS00YzIzLTg2MjgtOTUzNDZjMTk4ZjEzIiwiY2xpZW50X2l'
'kIjoiN2xxa2h2M3Q2Z2RiZGpuaDIwc2hwOWQ1dm4ifQ.DnCqgFv7veKuDAHp'
'YkwXeZPlBntxO3KIcu3IStmeUqpmxio_CKLm61-Y2YkyzyezKDee2IGgd2T3'
'dHMklUiY0QL2ssn-TcX7ZrJ0zd40xRGRv-vBoaKFPgr9wRPYt7F3CA9Ro0mt'
'bLjn6mwoffwtov5vhXRZWrKnhx-w_6tB8b93ptbhz1TRWly1YnEBTC2SMbcd'
'eP2UZaBUlqj-g_aXOU2mmSy9mVITlPn9yuEadHguj_dPJwqjm-yqChjnaTF-'
'gmWl5t1esRg7HuWqW_58AkbF_FF_JTSKPoaBKGp2ZmIQgkKxIAkegs7QXe6U'
'eQF_kbWYKPL2w24m8qB3nqAHAA", "expires": "2024-11-11T15:36:18'
'.393275Z", "scope": "rate"}} '
' '
This is how I have my data structure set up:
dcl-ds TokenResponse qualified;
response varchar(20000);
dcl-ds data dim(1);
token char(10000);
expires char(10);
scope char(10);
end-ds;
end-ds;
This is the command I execute:
data-into TokenResponse %data( response : 'case=convert')
%parser('YAJL/YAJLINTO');
DATA-INTO operation does not match the RPG Variable
-
- Posts: 7
- Joined: Mon Mar 20, 2023 2:54 pm
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: DATA-INTO operation does not match the RPG Variable
Your JSON is in this format:
Your RPG data structure is not in the same format. So it makes complete sense that you are getting this error.
You have a sub-structure named "data" which is also an array. There's nothing named "data" in the JSON and no arrays in the JSON. The JSON contains a sub-structure named "response", but your code has a character field named response. So you are not even close. They need to match... so something like this:
Code: Select all
TokenResponse = {
"response": {
"token": "string",
"expires": "string",
"scope": "string"
}
}
You have a sub-structure named "data" which is also an array. There's nothing named "data" in the JSON and no arrays in the JSON. The JSON contains a sub-structure named "response", but your code has a character field named response. So you are not even close. They need to match... so something like this:
Code: Select all
dcl-ds TokenResponse qualified;
dcl-ds response;
token varchar(10000);
expires varchar(30);
scope varchar(10);
end-ds;
end-ds;