Looks to me as if you may need to extract the value of "string" and then parse that JSON. i.e. it looks like a JSON payload nested as a sting within a JSON response.

If it is not then why are the quotes escaped?


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Feb 7, 2019, at 10:07 PM, Jay Vaughn <jeffersonvaughn@xxxxxxxxx> wrote:

Ok thx I’ll look into that. Thought for sure this was the same input string I’d used before. Maybe not.

Jay

On Feb 7, 2019, at 4:43 PM, B Stone <bvstone@xxxxxxxxx> wrote:

It doesn't look like there is an "env" object. It is a string in the
"string" object, not an actual object.

Bradley V. Stone
www.bvstools.com
MAILTOOL Benefit #1 <https://www.bvstools.com/mailtool.html>: Command and
ILE Interfaces available which means easily sending email from your
programs.

On Thu, Feb 7, 2019 at 2:13 PM Jay Vaughn <jeffersonvaughn@xxxxxxxxx> wrote:

i have the following code and trying to get this up and running (from a
working copy at a prior shop)... but yajl_get_string is returning
nothing... what should I look for?

EVAL jsoninp
JSONINP =
....5...10...15...20...25...30...35...40...45...50...55...60
1 '{"length":"121","string":"{\"env\":\"dev\",\"command\":\"GET'
61 '_LOAN_BORROWER\",\"payload\":[{\"loanNumber\":0000002428}]}"'
121 '} '
181 ' '

// load jSON object
g_docNode = yajl_buf_load_tree(%addr(jsonINP) + 2
:%len(%trim(jsonINP))
:g_errMsg);

return g_errMsg;


g_node = YAJL_object_find(g_docNode: 'env');
if yajl_is_false(g_node);
g_errMsg = 'Error - env Not Found In Input';
return g_errMsg;
endif;

g_environment = yajl_get_string(g_node);

Again, everything runs successfully until the last statement (and this used
to be working code on another box)... g_environment ends up with blanks...
what am I overlooking?

Jay
--
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 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 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


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.