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.

2 1
0 357
Article
· Jan 24, 2022 1m read
GlobalToJSON-Academic

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.

2 1
0 260

I have defined a class with a dynamic object property:

My class

The issue I encounter is that if a length of a serialized json property is more than 3641144 symbols, the object fails to save with the following error (either MAXSTRING or STRINGSTACK):

Length: 100 Result: OK
Length: 3641143 Result: OK
Length: 3641144 Result: OK
Length: 3641145 Result: ERROR #5002: ObjectScript error: <MAXSTRING>%GetSerial+1^%Library.DynamicAbstractObject.1
Length: 7282288 Result: ERROR #5002: ObjectScript error: <STRINGSTACK>%GetSerial+1^%Library.DynamicAbstractObject.1

Is there a workaround? I need to store moderately large jsons (10-15 Mb) and dynamic object properties allow for a very convenient access.

$ZSTORAGE is set to -1.

2 6
0 781
Question
· Jan 18, 2022
FHIR Bulk Data and ndjson

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).

0 1
0 383

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.

12 1
1 2.4K
Question
· Jan 3, 2022
JSON - NULL Properties

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.

0 2
0 494

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

2 5
0 643

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.

0 3
0 184

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.

12 34
6 1.5K
Question
· Jun 11, 2021
Parsing null values in JSON

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:

0 1
0 1.3K

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.

19 11
5 6.6K

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

0 7
0 397

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.

0 7
0 290

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.8K

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.

6 3
1 761

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

0 7
0 596
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",
0 4
0 439

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.

0 3
0 297

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).

0 6
0 343

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:

Automated user management in IRIS RAD Studio

https://www.youtube.com/embed/-Y2kaKES8yg
[This is an embedded link, but you cannot view embedded content directly on the site because you have declined the cookies necessary to access it. To view embedded content, you would need to accept all cookies in your Cookies Settings]

6 0
0 245

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: ""}}

2 9
0 641