Hi all,

I have an incoming JSON message with a string field exceeding in length the 'caché long-string limit' of 3641144 characters.

Using {}.%FromJSON(instream) I am able to create %DynamicObject properly. However, I am unable to access the long property, as in every assignment, I get the <MAXSTRING> error.

Is there any way for me to obtain contents of the 'too long' string field as a stream?

Thanks

Jiri

0 3
0 11.2K

I am still new to cache objectscript and am trying to figure out how I would go about removing the escape characters from my JSON below. When I call the $toJSON method it's adding the "\" character in the file path.

{"FileStatus":"P","Path":"\/somepath\/test\/test123\/filename.txt","InterchangeOID":"100458"}

My Code:

0 11
0 9.7K

I'm trying to set up VS Code for ObjectScript using the instructions found here. I've got both Cache 2018.1.2.309.0 and IRIS 2020.1.0.215.0. When I try to connect to either one of them the connection fails, and I get a notification in the bottom right corner that says "Unexpected token < in JSON at position 0". I've checked the JSON settings file that VS Code uses, and they're fine and formatted properly. All of the settings I've entered are correct.

0 20
0 4.7K
Question
· Mar 24, 2017
Convert to JSON string

here is my $ZV string "Cache for Windows (x86-64) 2016.2.1 (Build 803) Wed Oct 26 2016 12:43:35 EDT"

two questions

1. How do i convert any Persistent object to JSON String ?

2. How do i convert an y Register object to JSON string ?

3. Do i need to extend from any adaptor class for 1 & 2 ?

0 11
0 4.6K
Question
· Apr 1, 2017
XML to Json conversion

Hello,

Are there any utilities/api in HealthConnect 2016.2.1 that will allow conversion of XML virtual document to Json format? We were thinking to convert HL7 ADT message to XML via Ensemble DTL and then send it to another BP to convert to Json format for transmission via Web Services. To my understanding there isn't anyway to represent Json as a virtual object so it can be use for direct mapping of HL7 2.x message to Json via Ensemble DTL.

Thanks

Yuriy

0 3
0 2.6K
404 Not Found

{
"error": {
 "errors": [
  {
   "domain": "global",
   "reason": "notFound",
   "message": "Not Found"
  }
 ],
 "code": 404,
 "message": "Not Found"
 }
}

I want to do something like the above sample from a Google Storage JSON API. I have a call to Write obj.%ToJSON() followed by return ..ReportHttpStatusCode(..#HTTP404NOTFOUND) however the HTTP Status code is always 200. If I remove the Write obj.%ToJSON() statement it returns a 404 status with no body. How do I return both?

0 1
0 2.5K

Hi everyone,

I am still learning the platform for a student project and have to do some streaming and data analysis next. Since for my case I have no "live api" I wanted to just stream json files and output the data as it comes in from the files. (basically to emulate a incoming data scenario)

So thanks to the documentation and community posts I have figured how to create a stream and read data from a JSON but since I'm also new to JSON I have some parsing problems. I don't know how to access subarrays/sub-objects via objectscript.

0 2
0 2.4K
Question
· Dec 8, 2016
JSON to HL7

I have a project to convert a JSON message with two patient identifiers into an HL7 ADT^A31. Is there any documentation or training that you would think is appropriate?

Currently using Ensemble 2014.1.5 on AIX

0 1
0 2.3K

Hi , i have a JSON record as follow {value1,value2, value3}

i want to write my switch statement in this form:

<switch> my value
<case> value1</case>
<case>value2</case>
<case>value3</case>
​</switch>

is there any possibility to extract values from JSON record and put them in a switch statement?

thank's

0 1
0 2.1K

Hello community,

I am trying to parse the below HttpResponse in Cache. Cannot get the Iterator to work. Is there a single loop which can parse both or single messages and grab the error?

{
error:[
{ txt1:'error msg1'},

{ txt2:'error msg2'},
]
}

{
error: {
txt1:[
'error msg1',

'error msg2'
]
}

Thanks,

Jimmy Christian

0 16
0 2.1K

Say I have an ObjectScript object called Book. It has 2 properties title and author. It extends JSON.%Adaptor, so I can call book.%JSONExport() and get this output:

{ "title": "For Whom the Bell Tolls", "author": "Hemmingway" }

In my web service I want to have a search function that returns an array of Books along with the total number of responses, like this:

0 13
0 1.6K

Hello,

I am trying to use %ZEN.proxyObject to send out in JSON format so I do:

set tProxyRequest = ##class(%ZEN.proxyObject).%New()
set tProxyRequest.notanumber = "28001"
set tProxyRequest.aboolean = "true"

set tBody = ##class(%GlobalCharacterStream).%New()
do ##class(Ens.Util.JSON).ObjectToJSONStream(tProxyRequest,.tBody,"aelotwu")
w tBody.Read()

and I get:

0 10
0 1.4K
Question
· Aug 22, 2016
$fromJSON and MAXSTRING

Hi, all.
I have CSP application and it needs to get and process data from ajax request with json-content. JSON can be very big.
In this case:
TRY
{
Set RequestObj = ##class(%Object).$fromJSON(%request.Content.Read())
} CATCH(Exception) {
Set Status=Exception.AsStatus()
}
I get just part of getting JSON and validate error in $fromJSON.
If I try to read it all in cycle:
TRY
{
While (%request.Content.AtEnd = 0) {

0 6
0 1.4K

I need to convert an array with an unknown number of indices to a JSON string for transmission (which is why it isn't possible to iterate through it using $ORDER). Does ObjectScript provide functionality to convert an array to a JSON string?

Edit 1: As Joel mentioned, the array is subscripted and has an arbitrary structure like:

a(1)="a"
a(3,4)="b"
a(3,6)="c"
a(5,6,7)="d"

which needs to be converted to

0 6
0 1.4K

I am using studio 2015 version which does not have dynamic objects and I need to read xml and convert that to a json I have managed to come close to json string but with little difficulties .I need to be able to identify the root element and specify where to put braces between objects anyone with any idea is welcome he is my code so far

1 12
0 1.4K
Question
· Dec 19, 2016
HL7 Section to JSON

Hi all,

I'm trying to convert a HL7 section to a XML or JSON string.

We need to save the content of PID section into a SQL Column, therefore we need to convert it into a XML o JSON string

is there any easy way to convert it?

I've tried to convert it directly into a DTL, but all my attempts have been unsuccessful

Best regards,

Francisco Lopez

1 6
0 1.3K