CREATE JSON - exclude a column for a specific row - Forum - OpenEdge Development - Progress Community

CREATE JSON - exclude a column for a specific row

 Forum

CREATE JSON - exclude a column for a specific row

This question is answered

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

Verified Answer
  • 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
  • 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.
     
  • 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?

  • 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.
     
  • 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.