Container Output(JSON) adding [] to JSON

We are using Knime as a rest API for some data manipulation.

When the JSON column (1x1 table) is entered into the node, the output contains an extra [ ontop and an extra ] on the bottom.

Is there anyway to get rid of thee squares?

What I’m getting.
[
{
“multipleManditoryColumns”: [
{
“errorMsg”: “All columns mapped correctly”,
}
],
“errorCollumnMapping”: [
{
“errorMsg”: “All columns mapped correctly”,
}
]
}
]

What I want: (this is also the input to that node)
{
“multipleManditoryColumns”: [
{
“errorMsg”: “All columns mapped correctly”,
}
],
“errorCollumnMapping”: [
{
“errorMsg”: “All columns mapped correctly”,
}
]
}

Hi @tiaandp

Which version of KNIME are you using, and how are you seeing the response? I’m not seeing that occur on version 4.4.0 (haven’t tested others)

Here is the workflow I used to test it:
Json Output Test.knar.knwf (7.2 KB)

And here is the response I get if I call it via REST from a KNIME Server:

{
	"multipleManditoryColumns": [{
		"errorMsg": "All columns mapped correctly"
	}],
	"errorCollumnMapping": [{
		"errorMsg": "All columns mapped correctly"
	}]
}

One thing I notice about your input/output is they aren’t valid JSON. There shouldn’t be commas after the “errorMsg” objects

Regards,
Wali Khan

1 Like

Thanks so much for your reply.

Hi @wkhan

I’m on 4.2.3, which might be the issue.

Regarding the invalid JSON, There were more key value pairs, I deleted them just to keep the post short, I forgot to delete the comma.

Thanks so much for your reply. I think it might be due too the older version.

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.