Exposing "complex" JSON via RapidMiner Server
Hello, World!
I am using RapidMiner Server to expose an API that provides zones and coordinates to a custom map. Each zone can contain at least three coordinates, and the custom map creates drawings on these coordinates and performs decorations with other information. I currently have two endpoints looking like this (the rest of the info has been dropped for clarity):
Zones:
[
{ "id":1, "zone":"zone 1" },
{ "id":2, "zone":"zone 2" }
]
Coordinates:
[
{"id":1, "zone_id": 1, "x": 0, "y": 0},
{"id":2, "zone_id": 1, "x": 1, "y": 1},
{"id":3, "zone_id": 1, "x": 2, "y": 2},
{"id":4, "zone_id": 2, "x": 10, "y": 10},
{"id":5, "zone_id": 2, "x": 10, "y": 20},
{"id":6, "zone_id": 2, "x": 20, "y": 20},
{"id":7, "zone_id": 2, "x": 20, "y": 10}
]
How feasible is to end up with this as a JSON output?
[
{"id":1,"zone":"zone 1","coords":[{"x":0,"y":0},{"x":1,"y":1},{"x":2,"y":2}]},
{"id":2,"zone":"zone 2","coords":[{"x":10,"y":10},{"x":10,"y":20},{"x":20,"y":20},{"x":20,"y":10}]}
]
The idea is to just embed the coordinates inside the result, as an Array, and expose it. Currently I expose this as two separate API endpoints, but the designer has to build the object properly using JavaScript on the client side (let alone creating two requests to the RapidMiner Server, which is less than ideal), and that scenario is far from ideal.
I don't have XML to provide this time, but imagine two simple "Retrieve" operators connected to the results window.
I would appreciate your help, Thanks in advance!