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
How Intelligent is YAJLDTAGEN?
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: How Intelligent is YAJLDTAGEN?
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.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 you want to avoid them being generated, use countprefix, and set the count to 0.