|
On Aug 13, 2017, at 7:50 AM, Nathan Andelin <nandelin@xxxxxxxxx> wrote:
Henrik,
Maria was the one who first used the label "deep" to describe some of the
lesser-known procedure exports from YAJL. Your source-code example only
refers to the well-documented procedures, which require that the JSON
structure be known, before you can use them.
That program is "finding" a node reference by a name that must be known by
the programmer who is writing the code. Then looping through an array
within that node. The author of the program had to read the JSON himself in
order to write the code. That wouldn't work for generic utility.
Nathan.
On Sat, Aug 12, 2017 at 10:53 PM, Henrik Rützou <hr@xxxxxxxxxxxx> wrote:
Nathan,--
it is not a "deep" function to make a reading loop i YAJL:
https://www.fieldexit.com/forum/display?threadid=197
On Sat, Aug 12, 2017 at 10:45 PM, Nathan Andelin <nandelin@xxxxxxxxx>
wrote:
Maria,IBM
After reading this thread, I believe that I understand the gist of what
you're looking for. However, there is one part that I don't fully
understand, which you may be able to clarify.
My understanding is that you have web clients that send requests to an
i server, where the requests include JSON data (including hierarchicallyJSON
structured data) that you need to parse, extract, and map JSON name-value
pairs to IBM i externally described data structure values, which may be
used as parameters for making IBM i program calls.
You appear to want to write a generic utility that automatically maps
name-values pairs to externally described data structure values, as anYAJL.
alternative to the repetitive hand-coding required by the YAJL "find"
functions.
I think this can be done, but it appears to me that you may need some
tooling other than the YAJL "find" functions, because they require you to
have foreknowledge of the structure of the JSON that is received.
It may be possible for you to use some of the "deep" functions within
But the tests that I've run in that regard were not fruitful, except toto
confirm that I was unable to get them to work.
It appears to me that rather than YAJL "find" functions, you'll need
something more like an EXPAT parser, or some other way to monitor the
parsing, so that you can implement generic functionality to map JSON
name-value pairs to external data structure values, including conversion
correct data types.specification
Nathan.
On Sat, Aug 12, 2017 at 11:19 AM, Maria Lucia Stoppa <mlstoppa@xxxxxxxxx
wrote:
Joe, FFD may not be necessary because I can use external D
addingcopied through /Copy option instead. I will do some test using pointersand
deep YAJL available functions: maybe combining the two a new option maycode
arise.
Henrik, I am not sure about what you are meant to say. Looking at your
it seems to me that you are using a library different from YAJL whereyour
function comes from. In this case a program generator will help by
variablestandardised code to my sources, included specific reference to
thannames.there
Il 12/Ago/2017 19:02, "Henrik Rützou" <hr@xxxxxxxxxxxx> ha scritto:
Since most JSON comes in from AJAX the only rule there is, is that
is
no rules
and most inexperienced programmers do think that they are smarter
notwrote:standards
and main stream ways of doing things ;-)
On Sat, Aug 12, 2017 at 6:44 PM, Henrik Rützou <hr@xxxxxxxxxxxx>
joepluta@xxxxxxxxxxxxxxxxx
Okay, then take this input http://blablabla.pgm?parm1=
abcd&parm2=defg&json1={....}&json2={...}
Program generator?
On Sat, Aug 12, 2017 at 6:34 PM, Joe Pluta <
of
wrote:
Yes, this seems like the most straightforward approach, Jon. Kind
Sure,like a web service generator that builds code based on a WSDL.
haveTHEORETICALLY you could map the data dynamically by looking at an
externally described data structure, and done properly you'd only
temptationto
do it once, but the overhead of parsing an FFD every time could be
significant.
I like the generated adapter technique. A good balance between
flexibility and performance. As long as you can avoid the
to
tweak the generated code... :)
I concur with the others that in a language such as RPG this is
bereadily done. However, by constraining the problem space it can
onedone. I
http://ibmsystemsmag.com/ibmi/wrote up this technique some 10 years ago
developer/rpg/how-flexible-are-your-calculations-/ <
http://ibmsystemsmag.com/ibmi/developer/rpg/how-flexible-ar
e-your-calculations-/> and this followup article which took it
itstepknow
further.
http://ibmsystemsmag.com/ibmi/developer/rpg/even-more-flexib
le-calculations/ <http://ibmsystemsmag.com/ibmi
/developer/rpg/even-more-flexible-calculations/> providing you
thinkthe
names of all fields involved, then this could work but I don't
tgenerator
is
the best solution.
Instead in your case I would suggest writing a simple code
setswould be a more practical way of handling the multiple parameter
mappingthatwrite
you have. Rather than try and write a completely generic program
a
generic generator that spits out the RPG to do the JSON to DS
mlstoppa@xxxxxxxxx>forimpossible.
each of your DS. If the parameter set changes regen the code.
Nested structures would be harder to handle but by no means
Jon Paris
www.partner400.com
www.SystemiDeveloper.com
On Aug 12, 2017, at 3:12 AM, Maria Lucia Stoppa <
toJSONwrote:
Hello,
I am new to this forum, but I have done some research related to
and
couldn't find anything similar to my issue.
I am working on a proof of concept to code new programs in order
singleparse
the only received parameter formed as a JSON object into a data
structure.
I explain it better: previously, all our programs received a
in*entryparameter defined as an external data structure, so as soon as
plist
operation code is executed the data structure and all the fields
itcommon
were
filled in and made available for programs to use them (quite
membersolution). External data structure are defined as PF without
and
can
be used by any program that need to call the one which received
byasthat
a
parameter to perform a specific function.
Now we are moving our ERP's graphic interface to web: it means
a
program call can be executed by a store procedure called either
aweb
applications or by RPG programs. To serve the purpose of having
usingquick
programsUI
response, parameters are passed coded in a JSON object and new
have been coded to parse JSON input parameter field by field
bySK's
JSON APIs (thanks!).
I am guessing whether I can expand and generalize this behavior
parameternested)coding a
general routine which takes an external definition of JSON (even
structure and assigns each object's name found into JSON
onlyto
its
corresponding variable name's value.
My nightmares are: firstly, today's external DS are one level
correspondingand I
can't figure out how to represent nested levels; secondly how to
dynamically associate the value of JSON pair to its
affiliatetovariable's value according to its type.
One general idea might be to code some external D specifications
be(RPG400-L)
elementused
through /COPY option, which represent JSON structure in terms of
qualified
names and types, array included. Then JSON objects can be read
explicitlyby
element but how can I address the right DS variable without
otherwrite its name?
Can you suggest me some technique I haven't explored yet or any
(RPG400-L)--way
to approach the problem?
Thank you
This is the RPG programming on the IBM i (AS/400 and iSeries)
affiliatemailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://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
link: http://amzn.to/2dEadiD
--
Regards,
Henrik Rützou
http://powerEXT.com <http://powerext.com/>
--
Regards,
Henrik Rützou
http://powerEXT.com <http://powerext.com/>
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://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
(RPG400-L)link: http://amzn.to/2dEadiD--
This is the RPG programming on the IBM i (AS/400 and iSeries)
mailing list--
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://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: http://amzn.to/2dEadiD
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://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: http://amzn.to/2dEadiD
--
Regards,
Henrik Rützou
http://powerEXT.com <http://powerext.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@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://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: http://amzn.to/2dEadiD
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://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: http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.
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.