Question
Sabit Issakhan · Nov 26, 2020

Set null

Hello! 

How to set null in variable? 

I need to create JSON like below:

{

"id":"1",

"Code": null

}

 

00
1 0 3 120
Log in or sign up to continue

Replies

    set t={"id":"1","Code"2}
    write t.%ToJSON(),!
    
    do t.%Set("Code","","null")
    write t.%ToJSON()

%Set

Set Property Parameter %JSONNULL = 1

  Property Code As %String(%JSONNULL = 1);
Code = ""  >>> "Code":null
Code =$c(0)  >>> "Code":""