CREATE JSON - exclude a column for a specific row

Posted by terry_b on 05-Aug-2019 15:49

I am using the WRITE-JSON to export a temp-table. I am familiar with the SERIALIZE-HIDDEN option to exclude a column....How can I exclude a column for a specific row when a certain condition is met.

Thanks

Posted by Peter Judge on 05-Aug-2019 18:36

I think it's either that or read the JsonObject and remove the fields you're interested in removing.
 
You'll have to loop through an array of JSON objects for the table records, and I'm not sure which would be faster.
 

All Replies

Posted by Peter Judge on 05-Aug-2019 16:08

You'll have to write code. You can use FOR EACH and the SERIALIZE-ROW method to do most of the work, and then Remove('field-name') from the resulting JSON object before you add it to a parent array .
 
There's no concept of a JSON xPath in the ABL.
 

Posted by terry_b on 05-Aug-2019 18:13

Ok, thanks. My issue is that I'm using a ProDataSet, and this particular temp-table is about 3 levels in. So instead I should build the JSON manually?

Posted by Peter Judge on 05-Aug-2019 18:36

I think it's either that or read the JsonObject and remove the fields you're interested in removing.
 
You'll have to loop through an array of JSON objects for the table records, and I'm not sure which would be faster.
 

Posted by Robin Brown on 06-Aug-2019 15:29

The only condition that WRITE-JSON could react to is if the field's value is the same as the INITIAL value, and you use omit-initial-values.

This thread is closed