Skip to Main Content
IBM Z Software


This portal is to open public enhancement requests against IBM Z Software products. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (https://ideas.ibm.com).


Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Search existing ideas

Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,

Post your ideas
  1. Post an idea.

  2. Get feedback from the IBM team and other customers to refine your idea.

  3. Follow the idea through the IBM Ideas process.


Specific links you will want to bookmark for future use

Welcome to the IBM Ideas Portal (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.

ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.

Status Delivered
Workspace PL/I Compilers
Categories z/OS
Created by Guest
Created on Mar 14, 2024

JSONPUT suppress empty array occurrences

Reference case TS015700520

Please provide ability to suppress empty occurrences of arrays when using JSONPUT* functions. If any element of the array is present, provide that array occurrence. If all elements of an array are empty, suppress the generation of that entire array or generate an empty array as indicated by the developer. JSONOMIT is used in the examples below, however new attributes can be implemented if needed. A compile parm would not work since the same program (and even the same JSON) could have different rules for how to handle empty values.

Suggested new attributes:

JSONOMIT (specified on an array) – current behavior for existing attribute – generate empty occurrences, suppress if 0 occurrences

JSONARROMIT1 – Suppress empty array occurrences, generate empty array [ ] if 0 occurrences

JSONARROMIT2 – Suppress empty array occurrences, suppress array if 0 occurrences

Given the following structure:

DCL 1 json_struc,

5 elementOne JSONOMIT CHAR(10),

5 listElements(200) JSONOMIT CHAR(11),

5 array2 JSONOMIT,

7 name CHAR(25),

7 phone CHAR(15),

7 bday CHAR(10),

5 lastElement JSONOMIT CHAR(30);

We would like empty occurrences of listEmelements and array2 to be suppressed from the generated JSON. Multiple examples follow:

Assuming 2 listElements items are populated, we would expect the following:

{“elementOne”:”someValue”,

“listElements”: [

“Item1”, “item2”],

“lastElement”:”lastvalue}

Assuming 0 listElements items are populated, we might want the following:

{“elementOne”:”someValue”,

“listElements”: [ ],

“lastElement”:”lastvalue}

Or

{“elementOne”:”someValue”,

“lastElement”:”lastvalue}

Would need a way to indicate which output to provide when 0 occurrences are populated.

Given the following structure (same structure, repeated here for reference):

DCL 1 json_struc,

5 elementOne JSONOMIT CHAR(10),

5 listElements(200) JSONOMIT CHAR(11),

5 array2 JSONOMIT,

7 name CHAR(25),

7 phone CHAR(15), /* required */

7 bday JSONOMIT CHAR(10), /* optional */

5 lastElement JSONOMIT CHAR(30);

Assuming 2 array2 items are populated, and the second occurrence has blank phone and bday - we would expect the following:

{“elementOne”:”someValue”,

“array2”: [

{“name” : “Bob”,

“phone” : “123-555-1212”,

“bday” : “2024/03/14” } ,

{“name” : “Sue”,

“phone” : “” } ,

],

“lastElement”:”lastvalue”}

In the previous example, phone is required to be present even when blank/empty; and bday is optional and should be suppressed when empty.


Idea priority Medium
  • Guest
    Reply
    |
    Apr 8, 2024
    Yes, with JSONOMIT null values should be suppressed. This requires a library PTF
  • Guest
    Reply
    |
    Mar 29, 2024
    Yes, with JSONOMIT null values should be suppressed. This will be a library PTF