9 Followers · 447 Posts

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write.

Question Thomas Noitz · Jul 8, 2020

Hi everyone,

when I'm using the %JSONExport-function on Caché-Objects containing properties of type %integer, %numeric or %boolean, this properties are all automatically converted to Strings in the JSON-Output.

Is there a way to get around this type-cast?

Example:

Result with %JSONExport:

maxOrderable and maxReserveable are of type %integer, deliverable and assembly of type %boolean. All 4 properties are shown as quoted Strings.

Result with  ##class(%ZEN.Auxiliary.jsonProvider).%ObjectToJSON (same class+properties):

Thanks!

Thomas

11
0 621
Discussion Javier Llobet · Jul 8, 2020

I was trying the %JSON.Adapter backport to cache and try it also in IRIS and i found a kind of an issue regarding to export and object to json that is an inheritance of %ListOfObjects
If we have a list of elementtype of and object and then we try to export this to a json we get this json instead of a correct json.

exported json:

{
  "ElementType":"test.element",
  "Size":"1"
}

Json that we want:

[
  {
    "field1":"testField1",
    "field2":"testField2"
  }
]

Test classes:

Class test.elementList Extends (%ListOfObjects, %ZJSON.Adaptor){ 
 /// The type (class name) of the elements stored in the collection.
3
0 792
Question Pavithra Rajamohan · Jun 29, 2020

Hello,

I would like some advice please. I am trying to send a Httpnetrequest in the form of a JSON message. To request for the web token I have created a method which has the relevant message body and its corresponding values and sent this to the Process. The Process has a method called Transform Message which takes the message and changes it to JSON format and passes it through to the Operation. The Operation currently has the basic HTTPNetrequest listing the relevant information for the website that we are trying to reach. The task has been created to try and invoke the service into action.

S

1
0 417
Question Michael Fimbres · Jun 18, 2020

Running Cache 2017.2.2.

I'm trying to make a REST API call in JSON format. When using the example in the class reference documentation the getJSON method in the %Net.Http class throws the error  <METHOD DOES NOT EXIST> on a %Clone() method in the %LIbrary.DynamicObject class. I even changed the parameter to a JSON string to no avail. The  code will then fail on the %Compose method (examples below). My workaround is to use the %Net.HttpRequest functionality. Is there another workaround to this?

Example As Is:

USER>set continents =

2
0 333
Announcement Rob Tweed · Jun 11, 2020

If you're interested in building a browser-based CRUD application for maintaining data on IRIS, check out the detailed, step-by-step tutorial at:

https://github.com/robtweed/qewd-microservices-examples/blob/master/WIN…

To get a preview of the application you'll build in the tutorial, along with background on its technology stack, watch this video:

https://www.youtube.com/watch?v=d-NICYqv_2s

In summary, the key features and technologies that you'll be using and building out in this tutorial include:

- fully responsive interactive browser-based application - will also display correctly

0
0 1285
Job Nancy Martínez · Jun 8, 2020

Ready Computing is a full-service IT firm, specializing in software development and data exchange solutions within the healthcare industry.

We are looking for a highly-motivated staff that can guide clients in developing their healthcare IT strategy and back up that guidance with high quality technical work.Solution Consultants work directly with clients, IT vendors, and internal teammates to deliver integrated health solutions.Solution Consultants focus primarily on deploying high volume interfaces and interoperability software.

0
1 420
Article Oleh Dontsov · Jun 4, 2020 1m read

Sometimes you need quickly and easily import data into IRIS. For this, an IRIS import manager has been developed.

This application allows you to import JSON data and also provides a really simple interface for transferring data from MongoDB collections to IRIS globals. It has never been so easy.

Let's look at examples.

Import JSON

Suppose we have data in JSON format and we want to import it into IRIS. To do this, you just need to specify the global name and insert the data. After import, you will see the imported data. If global exists data will be overwritten.

Import MongoDB collections

There is

5
0 794
Question Warren Baldock · May 26, 2020

Hello All,

I am compiling a REST Operation to call our hospital Administration system, following tutorials around the REST API's etc. First time we have integrated like this so not much knowledge around our hospital - hoping someone on here can help.

I have been using the JSONStreamToObject Method which is working as i expected, apart from trying to get a specific item in the example JSON Response as follows:

{"test":"abc","name":[{"use":"usual","family":"Matest","given":["Mia"]}]}

I'm able to get family using set pResponse.familyname = tProxy.name.GetAt(1).family  , plus other properties within

2
0 659
Announcement Rob Tweed · May 15, 2020

I've created a new repository that I will use for providing examples of various scenarios and use cases for QEWD

https://github.com/robtweed/qewd-microservices-examples

Initially it contains a example of a scenario I'm often asked about: a set of REST APIs, with JWT support, implemented as a set of QEWD MicroServices, each of which uses Cache or IRIS running on a Windows system.

What I've provided is a detailed, step-by-step guide (with detailed explanations) of how to set up such a system.

The example shows a use case of REST APIs to:

- authenticate / login

- thereafter use a set of CRUD APIs to

0
1 502
Announcement Guillaume Rongier · May 5, 2020

objectscript-json-patch

alt text

An implementation of JSON-Patch in ObjectScript.

Why you should use JSON-Patch

JSON-Patch (RFC6902) is a standard format that allows you to update a JSON document by sending the changes rather than the whole document. JSON Patch plays well with the HTTP PATCH verb (method) and REST style programming.

Install

With zpm :

USER>zpm
zpm:USER>install objectscript-json-patch

How-To use it

Use it with this call :

Do ##class(Grongier.JSON.Utils).Patch(tDoc,tPatch)

Where :

  • tDoc is a %DynamicObject (JSON)
  • tPatch is a %DynamicArray of the patches (the JSON Patch).

The result will be tDoc p

2
1 487
Question Thembelani Mlalazi · Nov 14, 2017

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

ClassMethod WriteNodes(myfile As %String = "C:\Testdata\data.xml")
{
  set status=##class(%XML.TextReader).ParseFile(myfile,.textreader)
  
    if $$$ISERR(status)
      {
	    do $System.Status.DisplayError(status) 
	    quit
	  }

       set
12
0 1714
Article Lorenzo Scalese · Apr 27, 2020 1m read

Hi community,

This article to give a description of my small library JSON Filter.

Why JSON Filter?

Search, sort data are common operations.

But … How to do this with JSON data?

You can use a %DocDB, It’s a good way for storing JSON and index the main properties.

However, JSON document is very flexible. It isn’t always possible (and not recommended) to index each properties to process the wished queries. A manual processing on a data subset is may be required.

In my opinion, this is not a funny part of the job. It’s a repetitive code with many loops etc...

JSON filter allows to process these

1
1 593
Article Oliver Wilms · Apr 24, 2020 2m read

I enjoy the challenge of being in a contest.Currently I participate in InterSystems IRIS with REST API Programming Contest.My idea for this contest was to create an app to help me keep track of tasks for my Status Reports.I started with the template provided by Evgeny Shvarov.I created a persistent class for Tasks and a REST Dispatch class.I defined my URL map and I even figured out how to test my REST app using Postman.I felt proud of myself for a little while.

1
0 293
Question Florian Hansmann · Apr 16, 2020

Hey Community,

my Caché Version is 2013.1 and I can't update now.

I want to serialize a SQL Answer row into an Array filled with objects and then convert it to json.

Actually I use the following, which is very error prone when I have to do that often:

set list = ##class(%Library.ListOfDataTypes).%New()

       &sql(
            declare queryONLWK01 cursor for 
            select F0103, F0104
            into :articlenumber,  :amount
            from GL.ONLWK01
            where F0001 = :BET and F0002 = :DEB and F0003 = :MIT
       )
        &sql(open queryONLWK01)
        &sql(fetch
7
0 853
Question Rubens Silva · Apr 15, 2020

Hello,

Recently I have been required to work with a method called ExportToStream.

The situation asks me to export a UTF-8-encoded JSON as a XML to be imported on old releases. Here's how I attempted to fulfill this request:

do $System.OBJ.ExportToStream("path/to/my/json/file.json", .stream,,,"UTF8")

The file is indeed encoded as UTF-8 and although the XML header denotes that it has been exported as UTF8:

<?xml version="1.0" encoding="UTF8"?>

The body content seems to differ:

"text": "Condição de pagamento sujeito a análise de crédito: "

I will say it again, the original file is encoded

10
0 1166
Question Yone Moreno · Mar 25, 2020

Hello,

We have been reasearching how could we parse a string with a JSON structure like the following:

{"code":200,"type":"Consulta","message":"Operacion correcta","result":[{"id":38802130,"paciente":null,"prestacion":{"codigo":"1.52","descripcion":"Extracción ordinaria","tipo":null},"agenda":{"codigo":"TLAB","descripcion":"LABORATORIO CAE TELDE","sala":""},"servicio":{"codigo":"EXTIN","descripcion":"Unidad de Extracciones Insular"},"centroDerivacion":{"codigo":null,"descripcion":null},"centro":{"codigo":"350290","descripcion":"CHUIMI"},"medico":"Nombre4251 Apellido1_4251

1
0 382
Article Evgeny Shvarov · Nov 3, 2017 3m read

There are several options how to deliver user interface(UI) for DeepSee BI solutions. The most common approaches are:

  • use native DeepSee Dashboards, get web UI in Zen and deliver it in your web apps.
  • use DeepSee REST API, get and build your own UI widgets and dashboards.

The 1st approach is good because of the possibility to build BI dashboards without coding relatively fast, but you are limited with preset widgets library which is expandable but with a lot of development efforts.

The 2nd provides you the way to use any comprehensive js framework (D3, Highcharts, etc) to visualize your DeepSee data, but you need to code widgets and dashboards on your own.

Today I want to tell you about yet another approach which combines both listed above and provides Angular based web UI for DeepSee Dashboards -  DeepSee Web library.

16
5 2654
Question Mario Sanchez Macias · Mar 17, 2020
 

Hi, 

I know there are several alternatives, but I would like to find the easiest & simpler ones to store data coming in Json format from post requests and also allowing me to do SQL queries. 

I want to have a property called favouriteColors. I want to store a few colors, and I want to be able to do queries to get top favorite colors, etc... so not handling the list of colors as just a fixed string or fixed object. 

If I want to store this information, I have several alternatives, like %DynamicArray, list of %String o maybe just %String, but I  want to find the best way to store the property in

4
0 637
Article Jose-Tomas Salvador · Apr 25, 2018 2m read

What if you could serialize/deserialize objects in whatever format: JSON, XML, CSV,...; attending different criteria: export/import some properties and not others, transform values in this or that way before exporting/importing,...; and all of this without having to change the class definition? Wouldn't that be great??

Well, perhaps it's a goal too ambitious to reach 100% but, exploring this idea, I've developed a bunch of classes that I thought it was good to share. If you want to test, change, modify or improve the code, or just take a look at it, you can do it here. There you'll find a more detailed explanation (see Readme.md)

Be aware, this is a proof of concept for myself done in spare times, sure it's not robust enough or it can be done much better... but, I was just playing...ok, I could just wait to the new JSON Adaptor (coming soon!) that sure is going to resolve much more scenarios in a cleaner way, but... meanwhile... :-) ...
4
4 2800
Question Akshat Vora · Feb 22, 2020

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

{"1":"a", "3":{"4":"b","6":"c"}, "5":{"6":{"7":"d"}}}

I had considered using a combination of $Query (to traverse the array) and $Order (to retrieve property names) but was wondering if a

6
0 1895
Question Mathieu Van Sevenant · Feb 6, 2020

Hello everyone smiley

Here is a try of sending a stream object with %ToJSON() by HTTP POST request on a remote server.

First the JSON structure:

{
    "document": {
        "id": "{43495441-4445-4C4C-4500-0500129C762E}",
        "patient_id": "5003171TC01",
        "language": "fr",
        "doc_type": "CONS",
        "doc_time": "2019-06-12 11:02:00",
        (...)
        "Sections": [
            {
                "sectionId": "main",
                "Content":

7
2 1553
Question Yone Moreno · Feb 12, 2020

Hello,

We would like to convert a string which represents a dynamic JSON object, to a JSON.

We have:


linea: {"app_id":"5cf57b56-c3b4-4a0d-8938-4ac4466f93af","headings":{"en":"Cita Atención Primaria","es":"Cita Atención Primaria"},"subtitle":{"en":"C.P.ISORA","es":"C.P.ISORA"},"contents":{"en":"Aqui el contenido del mensaje si aplicase","es":"Aqui el contenido del mensaje si aplicase"},"data":"{\"centro\":\"C.P.

2
0 1927
Question Akshat Vora · Jan 21, 2020

I need to convert a JSON payload to a custom object type. Currently, I'm converting the JSON object to a %Library.DynamicObject object and need to proceed from here.

As of now, these are my options

                 1. Using an external library talked about in this link:

https://community.intersystems.com/post/binding-regular-cache-object-dynamicobject-and-vice-versa

Downside: Could be buggy (as admitted by the creator) + some other design concerns brought up in its the discussion thread

2.

4
1 1169
Question Nael Nasereldeen · Dec 10, 2019

Hi,

The class %JSON.Adaptor is very convenient,

I wonder if anyone faced the following scenario using it-

Exporting an object, that has a many to many relationship, and getting the details of the related objects.

For example, if we have three classes - Teachers, Students, and an intermediate class TeacherStudent .

The classes extend %JSON.Adaptor, and we would like to open a Student object, use %JSONExport, and get a JSON

That  includes the details of the student and all the teachers that teach the student, something like:

{
    "Id": "2",
    "Name": "Noname",
    "Teachers": [{
            "Id": "413",

6
0 617
Question Michael Davidovich · Dec 3, 2019

I am writing an API that sends over a very large JSON object. 

The code I'm using to get the data is actually used in our production system today for the use of writing a report.

However when I call the code using the API (using SoapUI) I am getting 'Error getting response; java.net.SocketTimeoutException: Read timed out'

The web applications settings have a session timeout setting at 15 minutes, but this is timing out within just a few minutes, so I know it's not hitting this mark.

Has anyone experienced this issue with APIs?

3
0 416
Article Peter Cooper · Mar 13, 2018 3m read

Index to Articles

Hi All

I am an avid user of ZEN for over 10 years now and it works for me.
But it seems that Intersystems are no longer actively developing it (or ZEN Mojo), the only published reference to this  is here

As an aside, Intersystems makes fine products (I have been using the technology for 35 years) and has great support BUT they are not good at being open with their product road map/retirement plans.  This is very embarrassing  to me when talking with my end user clients.

So I am looking at how to replace ZEN - this is not a short term project, at one client I have over 800 ZEN

10
1 2079
Question Larry Pinsky · Oct 21, 2019

I have a text file that I pick up in a Business Service and need to send it to our vendor via JSON.  I assumed (probably wrongly) that I could just create a RESTful Business Operation, plug in the server IP and URL as well as complete some of the other fields on the BO to send the file.  When I do this, I get the following error:

ERROR <Ens>ErrException: <PROPERTY DOES NOT EXIST>zOnMessage+5^EnsLib.HTTP.GenericOperation.1 *HTTPHeaders,Ens.StreamContainer -- logged as '-' number - @' Set tHeaderKey="" For { Set tHeaderKey=pRequest.HTTPHeaders.Next(tHeaderKey) Quit:""=tHeaderKey Set

4
0 935