JSON anomaly with ⎕DF Display Form
4 posts
• Page 1 of 1
JSON anomaly with ⎕DF Display Form
This is a bit odd. (Though I can guess what's going on, I won't).
Changing a display form for a simple JSON object adds a phantom entry in ⎕JSON calls to view object.
Changing a display form for a simple JSON object adds a phantom entry in ⎕JSON calls to view object.
- Code: Select all
)reset
a←⎕JSON '{"red":0,"orange":1}'
a.⎕DF 'display form'
a.⎕NL -⍳12 ⍝ Looks good
┌──────┬───┐
│orange│red│
└──────┴───┘
⍝ A new field with an unusual name appears holding the ⎕DF (display form) value.
⎕JSON⍠'D'⊣a ⍝ Default (⍠'D') and ⍠'M' both show oddity!
{"orange":1,"red":0,"ᐐཫ\u0001":"display form"} ⍝ internal magic ==> unicode?
a.⎕NL -⍳12 ⍝ Still looks good
┌──────┬───┐
│orange│red│
└──────┴───┘
⎕←a.⎕DF '' ⍝ We nulled out the ⎕DF for the object.
display form
⎕JSON⍠'D'⊣a ⍝ Odd display form (⎕DF) rogue entry still here!!!
{"orange":1,"red":0,"ᐐཫ\u0001":""}
- petermsiegel
- Posts: 143
- Joined: Thu Nov 11, 2010 11:04 pm
Re: JSON anomaly with ⎕DF Display Form
The namespace display form should not have been exposed by ⎕JSON at all. That has been fixed in the development interpreter (18.0) but not earlier versions; the reference for the fix is Mantis 16644.
I will reopen that issue to get the fix ported to all supported versions.
I will reopen that issue to get the fix ported to all supported versions.
-
Richard|Dyalog - Posts: 44
- Joined: Thu Oct 02, 2008 11:11 am
Re: JSON anomaly with ⎕DF Display Form
I was so much looking forward to using the "Unified Canadian aboriginal syllabics" character ᐐ (UCS 5136), aka the "Wii" Emoji, in all my programs!
- petermsiegel
- Posts: 143
- Joined: Thu Nov 11, 2010 11:04 pm
Re: JSON anomaly with ⎕DF Display Form
After some investigation I have elected not to patch the earlier versions. The potential to destabilise the current release has to be taken into account and compared against the severity of the issue being resolved - and in this case the fix is non-trivial and not easily back-ported, and the issue is relatively minor.
There is a workround (don't set the display form) - but if anyone feels the problem is critical we can reconsider.
There is a workround (don't set the display form) - but if anyone feels the problem is critical we can reconsider.
-
Richard|Dyalog - Posts: 44
- Joined: Thu Oct 02, 2008 11:11 am
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group