9 Followers · 447 Posts

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

New
Article David Hockenbroch · Feb 25 2m read

Inspired by @Ashok Kumar T's post on the ideas portal here as well as my own wishes for a solution to this problem, I have come up with a simple way to allow more complete and consistent JSON queries without having to specify every desired field. I have created a class that extends the built-in %JSON.Adaptor class and makes its %JSONExportToString and %JSONExportToStream methods accessible through SQL with just a couple of simple SqlProc Methods.

Class DH.JSONAdaptor Extends %JSON.Adaptor [ Abstract ]
{
ClassMethod jsonstring(id, map = "") [ SqlProc ]
{
	try{
		set myobj = ..%OpenId(id)
3
0 64
New
Article Oliver Wilms · Feb 25 2m read

iris-budget

I created iris-budget app for the InterSystems Full Stack Contest in 2026. By full stack, we mean a frontend web or mobile application that inserts, updates, or deletes data in InterSystems IRIS via REST API, Native API, ODBC/JDBC, or Embedded Python.

My app uses multiple REST APIs to add a new category or retrieve a list of categories of expenses and income.

First web application /csp/coffee

I inherited /csp/coffee from module.xml in iris-fullstack-template.

Second web application /csp/budget

For this project, I created a swagger file called "budget.json." I wanted to use the spec

0
0 37
New
Article David Hockenbroch · Feb 18 7m read

In the previous article, we examined how we can use the %CSP.Request and %CSP.Response classes to test a REST API without having the API fully set up and accessible across a network with an authentication mechanism. In this article, we will build on that foundation to perform some simple unit testing of one of our REST API methods.

The unit testing framework requires a couple of setup steps before we can use it.First, we have to ensure that the unit testing portion of the management portal is enabled so we can review the results of our tests.

0
1 108
New
Question Yann Simons · Feb 16

Hi,

I'm having a problem with %JSON.Adaptor and "list of" binding.

For exemple, this class with a property "oazisCode As list of %String".

Class User.ADGroup Extends (%Persistent, %JSON.Adaptor)

{
/// Code interne
Property code As %String;

/// Libellé
Property text As %String(MAXLEN = "");

Property oazisCode As list Of %String;

}

The first time call to %JSONImport works properly

s r = ##class(User.ADGroup).%New()
s json = {"code": "123", "text":"456", "oazisCode": ["1","2"]}
d r.%JSONImport(json)
w r.oazisCode.Size
2

If I call %JSONIMport a second time with another json , the

5
0 63
Question Evgeny Shvarov · Feb 5

Hi developers!

In a method I need to return a result as a dynamic object aka JSON Object. And here is my logic:

Classmethod Planets() as%DynamicObject {

 set val1="Jupiter"
 set val2="Mars"// this doesn't work! cannot compile
 return {"value1":val1, "value2":val2}

}

So I need to do the following:

Classmethod Planets() as%DynamicObject {

 set val1="Jupiter"
 set val2="Mars"
 set result={}

 set result.value1=val1

 set result.value2=val2

 return result

}

The second case works.Maybe I'm preparing the Dynamic Object in the wrong way?Can we just use variables inside JSON?

20
0 185
Question Scott Roth · Feb 5

I have always struggled with Iterating through a JSON response to pull out certain fields into a Data Class Structure to use to populate fields in a DTL. So I defined the whole structure for the following JSON, with the base structure extending Ens.Response, %XML.Adaptor, and %JSON.Adaptor.

{
    "status": {
        "message": "success",
        "code": 200
    },
    "data": {
        "client": "xxxxxxxxxxxxxxxxxxxxxxxx",
        "entities": [
            {
                "id": "xxxxxxxxxxxxxxxxxx`",
                "name": "xxxxxxxxxxxxxxxxx",
                "totalCommentCount": 
5
0 59