The READ-JSON method of the Dataset handle is able to read directly from a JSON object. But WRITE-JSON cannot write to a JsonObject. Is there a reason why that is not available? Or is it available and just not documented? Is there another way to do that (that does not require going via a LONGCHAR)?
You might see this twice. I replied to the e-mail and it hasn't shown up here yet.
Hi Mike,
No this is not currently possible. I know we have discussed this within the coreclient team. If it is not on our roadmap, then we should put it there.
Regards,
Robin
I see that as a huge limitation - especially now with the new Pacific Web Speed capabilities. So it should definitively be on the roadmap.
EDIT: ooops, reading the wrong way. It's the ability to have a Write(DATASET-HANDLE) that you want.
Have you looked at the Read() method on the JsonObject?
Read( INPUT DATASET-HANDLE pds-handle ) Read( INPUT DATASET-HANDLE pds-handle, INPUT omit-initial-values AS LOGICAL ) Read( INPUT DATASET-HANDLE pds-handle, INPUT omit-initial-values AS LOGICAL, INPUT read-before-image AS LOGICAL) Read( INPUT TABLE-HANDLE tt-handle ) Read( INPUT TABLE-HANDLE tt-handle, INPUT omit-initial-values AS LOGICAL ) Read( INPUT buffer-handle AS HANDLE ) Read( INPUT buffer-handle AS HANDLE, INPUT omit-initial-values AS LOGICAL )
Hi Mike:
This feature has been added to the backlog / roadmap.
Hi Peter, no I have missed that. Will test that. I looked at the ObjectModelParser as that seemed the right place for such functionality. So I'm glad, I'm not the only one who wasn't aware of that :-)
Evan, anyway, I believe a WRITE-JSON option would be helpful and consistent.
Thanks anybody!
Just for the record - Peter's method works from 11.4 on.
It happens I just have a need to do this. I ended up with this approach:
when type-of(pData, JsonConstruct) then do: cast(pData, JsonConstruct):Write(mData). /* can never be */ if type-of(pData, JsonArray) then do: create temp-table hData. hData:read-json(DataTypeEnum:Memptr:ToString(), mData). end. else do: create dataset hData. hData:read-json(DataTypeEnum:Memptr:ToString(), mData) no-error. if error-status:error then delete object hData. if not valid-handle(hData) then do: create temp-table hData. hData:read-json(DataTypeEnum:Memptr:ToString(), mData) no-error. if error-status:error then delete object hData. end. end. if valid-handle(hData) then do: this-object:Write(hData). cast(this-object:Value, WidgetHandle):AutoDestroy = true. end. end. /* JSON */
Hi Team,
Still the feature of WRITE-JSON METHOD not available for jsonobject ? .. , READ method of JsonObject helps what we need.
Progress knowledge has some details and example for WRITE-JSON related to JsonObjecy and JsonArray , may be needs correction?
documentation.progress.com/.../index.html
Thanks in advance!
-Anbu