jsonProvider - handling underscore character

Hi guys,

How do you deal with underscore characters when using jsonProvider  and exporting or importing ?

for example:

USER>s jsonString="{""what"":""1"",""up"":""2"",""test_test"":""3""}"
 
USER>set status = ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(jsonString,,.outputObj)
 
USER>w outputObj.what
1
USER>w outputObj.up
2
USER>w outputObj.test_test
 
W outputObj.test_test
^
<UNDEFINED> *test

 

we found out that we can access it like this, but not sure if it's the recommended method-

w outputObj.%data("test_test")

 

Regards,

Nael

  • 0
  • 0
  • 234
  • 10
  • 1

Answers

You can just use quotes

w outputObj."test_test"

Hi, Nael!

If the answer suits your question, would you please accept it?

TIA!

Alongside the "ANSWER" header, look for a checkmark that you can click. This screenshot highlights where:

Ok good to know thanks.

I accepted.

Its not east to notice it in my opinion.. but maybe it's just me.

Thanks,

Nael

Hi, Nael! Thanks for that! It makes DC more useful.

There is DC FAQ tag which illustrates this and other features of DC! HTH.

It's not just you. The DC UI needs improving in this area, IMO.

John, please share your ideas on this feature improvement.

Maybe display the unchecked marks to the OP using a jazzy animation. Make it irritating enough and perhaps they'll get around to accepting an answer just to calm their screen down wink