0

I´m importing a JSON-Datasource in Denodo which contains 2 arrays. In order to work with the data i flatten those arrays. However when delivering the data I want to get back to the initial array structure to get something like

{
  "name": "name_of_my_view",
  "elements": [
    {
      "result": [
        {
          "id": 40033495,
          "first_name": Max,
          "last_name": Mustermann
        },
        {
          "id": 39960791,
          "first_name": "Markus",
          "last_name": "Markwart"
        }
      ],
      "took_ms": 4,
      "result_count": 323,
      "errors": [
        {}
      ]
    }
  ],
"links": [
    {
      "rel": "self",
      "href": "https://address"
    }
  ]
}

I have flattend both arrays (result, errors) in order to edit the respective fealds within them. However i only see the option of using UNION to combine them. If i do so I end up having all fealds in one hierarchy like (Ignore the sorting in this example) Oh and note that "code" and "description" are within the "error" array and are not shown in the above example because there are no errors in it:

{
  "name": "name_of_my_view",
  "elements": [
    {
      "took_ms": 4,
      "result_count": 323,
      "code": null,
      "description": null,
      "id": null,
      "first_name": null,
      "last_name": null
    },
    {
      "took_ms": 4,
      "result_count": 323,
      "code": null,
      "description": null,
      "id": 40033495,
      "first_name": null,
      "last_name": null
    }
    ],
"links": [
    {
      "rel": "self",
      "href": "https://address"
    }
  ]
}
ThreexD
  • 1
  • 1
  • Okay i found that you can group columns with "register" that way I can get close to the wanted structure :) – ThreexD May 09 '19 at 13:48
  • you can also use "nest" if you want to create arrays instead of registers. – Montecarlo May 15 '19 at 06:56
  • awesome! Thanks for the help :) I now decided to leave the structure as it is and in case i need to edit fealds I´ll do so by writing my own VQL – ThreexD May 16 '19 at 15:38

0 Answers0