This package was triggered by the extra bonus points in the contest for writing the example
in embedded Python only. Therefore PURE
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write.
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write.
This package was triggered by the extra bonus points in the contest for writing the example
in embedded Python only. Therefore PURE
I will give you some additional information on my first embedded Python package.
it is written as a mix of python and ObjectScript to take the best of both worlds.
Hi Community,
I have json equivalent persistent object in pjsonObj variable. Final JSON example below.
{
"Document": {
"FileExtension": "pdf",
"FileContent": "JVBERi0xLjUNCiW1tbW1DQo...(very large bsae64 string)"
}
}
Here FileContent field in json will contain converted base64 string of very large pdf(10pages). I need to submit this json as a payload to REST endpoint.
below code is working fine.
set tSC=##class(%ZEN.Auxiliary.jsonProvider).%WriteJSONStreamFromObject(.newobj,pjsonObj,,,1,"aelqtw")
$$$LOGINFO("json"_newobj.Read())
I have created a package that offers a utility to load a Global into JSON object and reverse
to create a Global from this type of JSON object. Academic refers to the structure created.
Each logical node of the Global is presented separately with all its descendants.
Even if they don't contain any stored data.
Hello Community,
to return data from the OnPage() method of a %CSP.Page I used to simply write out the value of a %DynamicArray e.g. via
write tResponse.%ToJSON()
and return $$$OK afterwards.
Large objects bigger than 4MB result in an exception when trying to create return values using this way. What is best practice for returning values as JSON, especially if values exceeding the capcity of the %String class are to be expected? I saw that it is possible to write data to a file with e.g.:
set tmp = tResponse.%ToJSON("/opt/home/tmp/test_stream.txt")
Hi all,
I am testing asynchronous Bulk Data retrieve with a large EHR vendor. When I retrieve the bulk data, they are returning ndjson (CONTENT-TYPE of "application/fhir+ndjson; charset=utf-8"). If I attempt to process that content using JSON functions - I get
ERROR #5035: General exception Name 'Parsing error' Code '3' Data ''
For example, the following generates the error
s objArray={}.%FromJSON(quickStreamOut)
The error makes sense in that ndjson is not a valid json format (I assume at least).
or "So you just got yelled at by your boss, for sending him an unformatted Hello World webpage"
Our previous lesson ended with us serving a Message value obtained from a Caché REST service to the client, using Angular as a runtime. While there is a lot of moving parts involved in this process, the page is not especially exciting at the moment. Before we can start adding new features, we should take a step back and review our tools.
So I've been reviewing a lot of questions posted in the InterSystems community regarding NULL properties in JSON. I've also been reviewing the JSON documentation. None of these things have been able to help me so far.
1. We don't seem to have the %JSON.Adaptor class available for us to use in our system.
2. I'm not really confident enough to create JSON Type classes or backporting code, etc.
Hi All,
I am working in Heath Share Heath Connect Integration.
I have a requirement to change SOAP call to REST call in integration. For SOAP call already payload is ready in XML string. and Working fine.
Now I need to make REST API call instead of existing SOAP call.
I have created REST Business Operation and ready to Call it from Business Process.
Here I should not change any Transformation in Business Process , only change in Operation invocation
Only change is existing SOAP Operation expecting XML String , new REST Operation is expecting JSON.
I have an issue where a Windows Reserved word, in my case CON, is causing an error when used as part of a JSON Get operation. In this case CON is the user identifier (the full identifier is CON.SURNAME) of a person and I am trying to read the employee record using a web service provided by the payroll system.
Is there a way I can get around this, some sort of encoding that would enable the inclusion of this identifier. I can't just change the identifier has it is used extensively across systems.
hello!
i have object bellow
Set object = ##class(%ZEN.proxyObject).%New()
set object.city = "New York"
set object.Target = "TEST"
set object.Details = "TEST"
set object.RefCode = "123"
set object.Reason = "123TTTT"
I want to get string from json object.
Could you help please ?
Over the past year or so, my team (Application Services at InterSystems - tasked with building and maintaining many of our internal applications, and providing tools and best practices for other departmental applications) has embarked on a journey toward building Angular/REST-based user interfaces to existing applications originally built using CSP and/or Zen. This has presented an interesting challenge that may be familiar to many of you - building out new REST APIs to existing data models and business logic.
Hello everyone,
I'm creating a REST API with InterSystems Ensemble.
I already have a POST route that parses JSON content into an object defined in a class.
To parse the JSON content, I'm using the JSONStreamToObject method in the Ens.Util.JSON class
Here is how I use it:
Set tSC = ..JSONStreamToObject(%request.Content, .tObject, "MyClass", 1)
While the route works and does what it should, in theory.
I noticed that when passing empty string or null values inside the JSON content, the values do not appear at all in the object's instance.
So, one day you're working away at WidgetsDirect, the leading supplier of widget and widget accessories, when your boss asks you to develop the new customer facing portal to allow the client base to access the next generation of Widgets..... and he wants you to use Angular 1.x to read into the department's Caché server.
There's only one problem: You've never used Angular, and don't know how to make it talk to Caché.
This guide is going to walk through the process of setting up a full Angular stack which communicates with a Caché backend using JSON over REST.
Hello everyone,
I created a Class with this 3 properties
Class TestDynamic Extends (%RegisteredObject, %XML.Adaptor)
{
Property number As %xsd.string;
Property exam As %xsd.string;
Property result As list Of %DynamicObject;
}I'm adding objects to list normally
set objTest=##class(TestDynamic).%New()
set objDynamic={"field":"value"}
do objTest.result.Insert(objDynamic)But when i use this method to convert to JSON
##class(%ZEN.Auxiliary.jsonProvider).%ObjectToJSON(objTest,,,"aeoqtw")It doesn't show the items from %DynamicObject just show this:
Hi all, I am new to IS Objectscript and I would appreciate some assistance regarding this.
I am trying to find out how to count the number of elements within a dynamic abstract object and I am having some trouble using the size method.
Here is the code below:
The key value pairs are originally in JSON and I would have converted it in to an object for use.
Hi guys,
It's FHIR contest and this time, they provided something really cool: FHIRaaS
And to be part of this, @José Pereira and I team up (again) to deliver something easy to use and easy to understand how we did.
I cannot convert the R4 version of the JSON file through the built-in dtl, and convert it to SDA, I hope to get an answer, thank you very much
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. I suspect that there's a response coming back from the server that VS Code is expecting to be JSON, but isn't. It pops up any time I click on
pResponse.%JSONImport(tHttpResponse.Data) failing when we have mulitple (array) json objects in response.
set patientSearchList = ##class(msg..patient.PatientSearchList).%New()
s rListObj={}
d rListObj.%Set(ListViewName,[].%FromJSON(tHttpResponse.Data))
do pResponse.%JSONImport(rListObj)
What's the better way to handle multiple json objects coming in response.
Let's imagine if you would like to write some real web application, for instance, some simple clone of medium.com. Such sort of application can be written using any different language on the backend side, or with any framework on the frontend side. So many ways to do the same application, and you can look at this project. Which offers a bunch of frontends and backends realizations for exactly the same application. And you can easily mix them, any chosen frontend should work with any backend.
Let me introduce the same application realization for InterSystems IRIS on a backend side.
Hello,
I am trying to find out if it is possible to decode the Azure access token in IRIS. Has anyone ever tried this before? I need to decode the token to extract the "Scope" details in order to verify the scope to make sure client is permitted to do the request they have done.
If you could point me to any information, that'd be great.
Thank you.
Utsavi
Hello! I have a question how to parse Library.ListOfObjects to JSON
I send post data like this from client using rest and want parse "templates", after save "codeForm","codeName" in database
{
"whoIs": "",
"templates": [{
"codeForm": "FORM_FIOGROUP",
"codeName": "operationDate",
"orderNumber": "1",
"codeFormat": "YYYY-MM-DD",
"header": "DATE",
"dbfFormatType": "Date",
"dbfFormatLength": "8",
"valueFrom": "Payment"
}, {
"codeForm": "FORM_FIOGROUP",InterSystems IRIS 2019.1 has been out for a while and I would like to cover some enhancements for handling JSON which might have gone unnoticed. Dealing with JSON as a serialization format is an important part of building modern applications, especially when you interact with REST endpoints.
Hello
I am creating an import tool to convert a client's JSON data into IRIS classes. The sample file is over half a gig. I am copying the data into an instance of %Stream.FileCharacter;. My first few attempts worked fine. However I started getting an error thrown when I try to create a DynamicAbstractObject using the %FromJSON method. See the code below. The error code given is not in the documentation, at least not the doc that I was searching.
"READ error while reading input stream, Line 5121169 Offset 23, error code 10"
Can anyone shed light on this error code?
I had a challenge recently where I was asked to parse and iterate JSON to find a patient that has a forename = "Bill" and try to make the function that iterates through the code re-usable.
Being working in Healthcare there isn't much experience or demand for parsing JSON, as most of my work is HL7.
I took this on using the documentation and worked out a way to parse the JSON (see posts below for code and source data).
I've worked out how to iterate through the fields and repeating elements, however I'm having an issue quitting out upon finding a patient with the forename Bill.
Hey Developers,
Enjoy watching this brief explanation of a new feature in IRIS RAD Studio – a new project by @José Pereira and @Henrique.GonçalvesDias:
Hi!
I am making a request to an API and JSON is coming as follows:
SET %httprequest = ##class(%Net.HttpRequest).%New()
DO %httprequest.Get(URL)
SET %responseBody = %httprequest.HttpResponse.Data.Read()
W %responseBody
{produto:"CHP0001",Local:{IDMV: "000000001",LOTE: "",DtFabric: "null",DtVenc: "null",Atributo06: "0000000002",Atributo07: "",QtdeDisp: "10.00000",QtdeAloc: "0.00000",QtdeSep: "0.00000",QtdeTotal: "10.00000",Status: "OK",Motivo: ""}}
@José Pereira and I created a good project, and we want to introduce a few words about this project to you.
IRIS RAD Studio is our idea of a low-code solution to show what's possible, to make the developer's life easier.
There's been quite a bit of discussion lately in this forum on the tools available in IRIS for using both XML and JSON, and debate on cross-conversion between the two formats.