Article
· Mar 31, 2023 3m read
Using JSON in IRIS

Saw the other day an article with the usage of the %ZEN package when working with JSON and decided to write an article describing a more modern approach. At some recent point, there was a big switch from using %ZEN.Auxiliary.* to dedicated JSON classes. This allowed to work with JSONs more organically.

Thus, at this point there are basically 3 main classes to work with JSON:

  • %Library.DynamicObject - provides a simple and efficient way to encapsulate and work with standard JSON documents. Also, there is a possibility instead of writing the usual code for creating an instance of a class like
set obj = ##class(%Library.DynamicObject).%New()

it is possible to use the following syntax

set obj = {}
  • %Library.DynamicArray - provides a simple yet efficient way to encapsulate and work with standard JSON arrays. With arrays you can use the same approach as with objects, meaning that yu can either create an instance of the class
set array = ##class(%DynamicArray).%New()

or you can do it by using brackets []

set array = []
  • %JSON.Adaptor is a means for mapping ObjectScript objects (registered, serial or persistent) to JSON text or dynamic entities.
10 5
2 710
Question
· Mar 27, 2023
JSON Validation Errors

When using %JSONImport it seems to only report a single error, is there a way to report all the errors with out having to do multiple requests?

{

"errors": [

{

"code": 9406,

"domain": "%ObjectErrors",

"error": "ERROR #9406: Unexpected format for value of field, CurrencyCode, using Update mapping",

"id": "JSONImportError",

"params": [

"CurrencyCode",

"Update"

0 1
0 258

Hello, I want to show a fellow DC member how to convert JSON file into HL7 message. I personally do not work with HL7. I set up a production with EnsLib.File.PassthroughService. It passes Ens.StreamContainer to BPL process. I call a DTL to transform StreamContainer to HL7 message. I run into an error:

ERROR <Ens>ErrBPTerminated: Terminating BP JSON2HL7 # due to error: ERROR #5035: General exception Name 'Parsing error' Code '3' Data ''
> ERROR #5035: General exception Name 'Parsing error' Code '3' Data ''

The code is in this GitHub repo:

0 2
0 406

Foreword

InterSystems IRIS versions 2022.2 and newer feature the ability to authenticate to a REST API using JSON web tokens (JWTs). This feature enhances security by limiting where and how often passwords transfer over the network in addition to setting an expiration time on access.

The goal of this article is to serve as a tutorial on how to implement a mock REST API using InterSystems IRIS and lock access to it behind JWTs.

10 0
6 982
Article
· Mar 7, 2023 10m read
Reference for the JSON Web Classes

Foreword

InterSystems IRIS versions 2022.2 and newer feature a redesigned functionality for JSON web tokens (JWTs). Once housed under the %OAuth2 class package, the JWT class, along with other JSON web classes (JWCs), now live under %Net.JSON. This migration occured in order to modularize the JWCs. Before, they were closely intertwined with the implementation for the OAuth 2.0 framework. Now, they can be maintained and used separately from OAuth2.

2 0
0 356

Hi folks!

Examining FHIR profile validation with InterSystems FHIR server. FHIR profiles is a very useful feature of FHIR standard that helps an organization or solution to establish constraints to a very disperse FHIR standards that are relevant to a particular business solution. Learn more on FHIR profiles.

I created a very simple FHIR profile with the following JSON:

0 6
0 390

Hi folks!

Researching FHIR bundle transactions.

The idea is that you can post a bundle to a FHIR server with a set of resources. And you can send it as a transaction, so only all the resources will be published or neither.

E.g. I send a bundle of two resources: patient and its observation.

The observation resource should reference an existing patient. But it probably doesn't exist yet on the server and goes within the same bundle.

For this purpose there is a way to have a temporary id in the bundle, to let resources reference ids.

0 5
0 141

Why I've decided to write this

Once again I had a challenge that costed me some time and a lot of testing to reach the best solution. And now that I've managed to solve it, I'd like to share a little bit of my knowledge.

What happened?

In a namespace there were a lot of similar classes, so to make them simpler there were a superclass with comon properties. Also, there are relationships between them. I had to export one of them to JSON, but I couldn't change the superclasses, or I would break down the flow of many other integrations.

4 0
1 287

Recently i've been using Restforms2 to create a CRUD API for a project. But it lacks some advanced functionality that we need, so we have created a production with a REST WS which handles those advanced methods. That works great but there's a drawback, it does not have authentication.

I would want to use the same authentication method as Restforms2 which is a basic auth using IRIS users and passwords.

0 4
0 451
Article
· Jan 30, 2023 2m read
JSONfile-to-Global #1

The similarity between JSON objects + arrays and Globals in IRIS or Caché is evident.
With small and medium size JSON objects navigation across %Dynamic Objects is comfortable.
But with large and/or deep cascaded objects it becomes a challenge.

The presented tool offers 3 variants

  • loading an already existing %Dyamic object or Array into a global of your choice
  • loading a %Stream containing a JSON object into a global of your choice
  • loading an external File containing a JSON object into a global of your choice

6 1
2 233

Hi Developers,

Enjoy watching the new video on InterSystems Developers YouTube:

Modern(izing) Full Stack Development on InterSystems IRIS @ Global Summit 2022

https://www.youtube.com/embed/wMMRprv_4_4
[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]

3 2
1 419

Hi Developers!!,

I know what you are thinking... a new feature for ZEN.proxyObject...? NOW..???

In Spain we say that better late than never ;-)

Have you ever need to send a numeric attribue of a Json in String format?

Did you go crazy casting class objects with fixed typed properties?

Lucky you!!

With this new feature I propose a way to continue working with our loved dynamic object %ZEN.proxyObject, being able to choose whether or not we want to send numeric attributes in String format.

2 1
0 310