Write-Json On Dataset and Temp-table Omits logical fields with value = False - Forum - OpenEdge Development - Progress Community

Write-Json On Dataset and Temp-table Omits logical fields with value = False

 Forum

Write-Json On Dataset and Temp-table Omits logical fields with value = False

This question is answered

HI All.

I have a Pasoe rest API where in one of the request the response is a temp-table defined in a dataset  with among others one logical field.

When this field has the value "true" the field comes out ok in the response Json, but when it is set to false, the field disapears from the response json and is not shown.

Why is that?

I am using write-json on dataset for the output.

dataset dsResponse:WRITE-JSON ("longchar", oinvoice,FALSE,"UTF-8",YES,YES).

Any response would be appreciated.

Verion in use is Openendge 11.7.3

Verified Answer
  • Your second "YES" instructs the WRITE-JSON to skip values that match the initial value.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • The first "YES" is the omit-initial-values parameters. Since false is the initial value it is omitted.

All Replies
  • Your second "YES" instructs the WRITE-JSON to skip values that match the initial value.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • The first "YES" is the omit-initial-values parameters. Since false is the initial value it is omitted.

  • And if you wish to continue omitting the initial value - define the temp-table field initial value as unknown (?), both true and false will then be written.

  • WRITE-JSON ( target-type

     , { file | stream | stream-handle | memptr | longchar

           | JsonArray | JsonObject }

     [ , formatted [ , encoding [ , omit-initial-values  

     [ , omit-outer-object [ , write-before-image ] ] ] ] ] )

  • aha Of course, my bad.! In other words , read the docs. Sorry, only my second week with progress abl.