arraysjsonaltovamap-force

Altova MapForce - How to seperate Json objects from one json file?


Within Mapforce I have a get request to an API that returns data in the form of this json schema:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "@odata.context": {
      "type": "string"
    },
    "@odata.count": {
      "type": "integer"
    },
    "value": {
      "type": "array",
      "items": [
        {
          "type": "object",
          "properties": {
            "displayName": {
              "type": "string"
            },
            "givenName": {
              "type": "string"
            },
            "id": {
              "type": "string"
            },
            "surname": {
              "type": "string"
            },
            "userPrincipalName": {
              "type": "string"
            },
            "mail": {
              "type": "string"
            },
            "mobilePhone": {
              "type": "string"
            },
            "assignedLicenses": {
              "type": "array",
              "items": [
                {
                  "type": "object",
                  "properties": {
                    "skuId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "skuId"
                  ]
                }
              ]
            }
          },
          "required": [
            "displayName",
            "givenName",
            "id",
            "surname",
            "userPrincipalName",
            "mail",
            "mobilePhone",
            "assignedLicenses"
          ]
        }
      ]
    }
  },
  "required": [
    "@odata.context",
    "@odata.count",
    "value"
  ]
}

This returns one big json file with multiple objects of every user with also an array within every object. Now I'm trying to seperate these user objects within Mapforce, so I can use it for other purposes. But I'm not able to figure it out. I've tried simple methods like outputting it to a text file and using the objects, counts, item, additionalproperties and more for the rows mapping, but everytime it returned nothing or only information from the first object.

The image is to get an idea, I've tried lots of other options. This must probably be simple, but I can't figure it out. Thanks in advance.

enter image description here


Solution

  • Your schema only specifies one item per array. Try removing the square brackets on "items".