User bio
404 bio not found
Member since Nov 11, 2015
Pinned posts:

You can still use classes, just add  %JSONIGNOREINVALIDFIELD to ignore unknown properties:

Parameter %JSONIGNOREINVALIDFIELD As BOOLEAN = 1;

Here's how your example can look like:

Class dc.Item Extends (%RegisteredObject, %JSON.Adaptor)
{

Parameter %JSONIGNOREINVALIDFIELD As BOOLEAN = 1;

Property pureId As %Integer;

Property portalUrl As %VarString;

}

and the main class:

Class dc.Response Extends (%RegisteredObject, %JSON.Adaptor)
{

Parameter %JSONIGNOREINVALIDFIELD As BOOLEAN = 1;

Property items As list Of Item;

/// do ##class(dc.Response).Test()
ClassMethod Test()
{
	set json = ..Sample()
	set obj = ..%New()
	$$$TOE(sc, obj.%JSONImport(json))
	do obj.DisplayItems()
}

Method DisplayItems()
{
	for i=1:1:..items.Count() {
		set item = ..items.GetAt(i)
		zw item
	}
}

ClassMethod Sample() As %String [ CodeMode = expression ]
{
{
  "count": 0,
  "pageInformation": {
    "offset": 0,
    "size": 0
  },
  "items": [
    {
      "pureId": 0,
      "uuid": "196ab1c9-6e60-4000-88cb-4b1795761180",
      "createdBy": "string",
      "createdDate": "1970-01-01T00:00:00.000Z",
      "modifiedBy": "string",
      "modifiedDate": "1970-01-01T00:00:00.000Z",
      "portalUrl": "string",
      "prettyUrlIdentifiers": [
        "string"
      ],
      "previousUuids": [
        "string"
      ],
      "version": "string",
      "startDateAsResearcher": "1970-01-01",
      "affiliationNote": "string",
      "dateOfBirth": "1970-01-01",
      "employeeStartDate": "1970-01-01",
      "employeeEndDate": "1970-01-01",
      "externalPositions": [
        {
          "pureId": 0,
          "appointment": {
            "uri": "string",
            "term": {
              "en_GB": "Some text"
            }
          },
          "appointmentString": {
            "en_GB": "Some text"
          },
          "period": {
            "startDate": {
              "year": 0,
              "month": 1,
              "day": 1
            },
            "endDate": {
              "year": 0,
              "month": 1,
              "day": 1
            }
          },
          "externalOrganization": {
            "uuid": "196ab1c9-6e60-4000-8b89-29269178a480",
            "systemName": "string"
          }
        }
    ]
    }
	]
}.%ToJSON()
}

}
Open Exchange applications:
Certifications & Credly badges:
Eduard has no Certifications & Credly badges yet.
Global Masters badges:
Followers:
Following:
Eduard has not followed anybody yet.