How Intelligent is YAJLDTAGEN?

Discussions relating to the ScottKlement.com port of the open source YAJL JSON Reader/Generator. This includes the YAJL tool as well as the YAJLR4, YAJLGEN, YAJLINTO and YAJLDTAGEN add-ons from ScottKlement.com. http://www.scottklement.com/yajl/
Post Reply
bbunney
Posts: 45
Joined: Wed Jul 06, 2022 7:52 pm

How Intelligent is YAJLDTAGEN?

Post by bbunney »

We are beginning to use Data-Gen with YAJLDTAGEN as we recently went from V7.2 to V7.4. We have a JSON document that contains a "response" object, a "body" object and a JSON array called "printers". If errors are encountered during processing, we only want to generate the "response" object and not the "body" object or "printers" JSON array. The other use case is if the process was successful and there are no printers found we don't want to include the "printer" JSON array in the JSON document.

Is there a way for YAJLDTAGEN to not generate certain objects or fields from a nested DS for the JSON document generation? The fields are all defined as VarChar and set to null initially. If all of the values in the "body" object are null, does YAJLDTAGEN skip them? If not then I would guess that I would need to create 2 additional DS's, one for just the "response" object only and the other for just the "response" object and "body" object and then determine which DS to generate the JSON from?

Thanks,
Brian
Scott Klement
Site Admin
Posts: 658
Joined: Sun Jul 04, 2021 5:12 am

Re: How Intelligent is YAJLDTAGEN?

Post by Scott Klement »

Is there a way for YAJLDTAGEN to not generate certain objects or fields from a nested DS for the JSON document generation? The fields are all defined as VarChar and set to null initially.
Not sure what you mean by this. I'm not aware of any way to set a field to null. Even if you could do that, though, that wouldn't result in parts of the document not being generated, but rather it would result in them being generated as null.

If you want to avoid them being generated, use countprefix, and set the count to 0.
Post Reply