Can´t get the right json structure

Hi!

I am struggeling with the structure of my json since two days, and i can´t figure out whats wrong.

Acually its simple. I use “notion search objects” to read from my notion database.

name of the database is “systemfamilies”. The Database ist pretty small, there are just some names in it.

Next I use “JSON-Aggregate to JSON”.
I also testet different settings with Array Aggregation, but it wasn´t successful.

What i want:
{
“Systemfamilien”: [
{ “Name”: “Unterdach-24” },
{ “Name”: “MW-Innenmauerwerk, d=24.0 cm, KP+KP” },
{ “Name”: “MW-Innenmauerwerk, d=17.5 cm, KP+KP” },
{ “Name”: “GIS-15” },
{ “Name”: “MW-Außenmauerwerk, d=42.5 cm, AP+KP” },
{ “Name”: “MW-Außenmauerwerk, d=36.5 cm, AP+KP” }
]
}

What i get:
[
{
“Systemfamilien”: [
{ “Name”: “Unterdach-24” }
]
},
{
“Systemfamilien”: [
{ “Name”: “MW-Innenmauerwerk, d=24.0 cm, KP+KP” }
]
},
{
“Systemfamilien”: [
{ “Name”: “MW-Innenmauerwerk, d=17.5 cm, KP+KP” }
]
},
{
“Systemfamilien”: [
{ “Name”: “GIS-15” }
]
},
{
“Systemfamilien”: [
{ “Name”: “MW-Außenmauerwerk, d=42.5 cm, AP+KP” }
]
},
{
“Systemfamilien”: [
{ “Name”: “MW-Außenmauerwerk, d=36.5 cm, AP+KP” }
]
}
]


Thank you!

Hey Johannes,

can you copy paste the output bundle of the Search Objects module here?

Sounds like you want an array of names but you are getting a new array for each name. Usually this is a configuration issue where you are aggregating the wrong module and/or mapping the wrong item.

Hey Stoyan,

thanks for your reply.

Of course.
The Notion DB is not that small, because of that the output of the search is large.
so i put it in a Textfile. hope thats okay.
Textdokument (neu).txt (86.4 KB)

You described it really well. I want an array of names in my current test, but i get an array for each name.

In the End there should be not just the name. It shoul look like this:

{
“Systemfamilien”: [
{
“Name”: “Unterdach-24”,
“EndCap”: “225f7294-5e18-809e-9274-c6debbf72395”,
“OpeningWrapping”: “225f7294-5e18-81f3-85ec-fc69a2e84f12”,
“VariableLayerIndex”: -1,
“ExteriorShellLayerCount”: 0,
“InteriorShellLayerCount”: 0,
“StructuralMaterialIndex”: null
},
{
“Name”: “MW-Innenmauerwerk, d=24.0 cm, KP+KP”,
“EndCap”: “225f7294-5e18-809e-9274-c6debbf72395”,
“OpeningWrapping”: “225f7294-5e18-81f3-85ec-fc69a2e84f12”,
“VariableLayerIndex”: -1,
“ExteriorShellLayerCount”: 0,
“InteriorShellLayerCount”: 0,
“StructuralMaterialIndex”: null
},

}
]
}

but the principle stays the same.

Ok so the way you have it setup right now is that each bundle will create its own array called Systemfamilien with whatever you have defined inside. Remove the array element on top and just leave the whatever you have inside as the desired structure. So for example leaving only the Name as a text field, the aggregator will produce this:
[{"Name":"Unterdach-24"},{"Name":"MW-Innenmauerwerk, d=24.0 cm, KP+KP"},{"Name":"MW-Innenmauerwerk, d=17.5 cm, KP+KP"},{"Name":"GIS-15"},{"Name":"MW-Außenmauerwerk, d=42.5 cm, AP+KP"},{"Name":"MW-Außenmauerwerk, d=36.5 cm, AP+KP"}]

Once you have the array itself, you can add the rest in a set variables module or directly in the next module.

1 Like

Thats it!

Thank you very much, Stoyan! You saved me a lot of work!

1 Like