how to get custom form of JSON

Hello everyone!
In the beggining of my data transformation I had:
{ key3 : false }
In the picture you can see how my data looks so far.

image

To achieve result I have so far, I used: 1x node Table to JSON and 2x JSON Column Combiner (I used “Cutom key” option for insterting “key1” and “key2” in my data)

Any tips how to achieve my desired form of JSON?
Thank you in advance,

Denis :smiley:

Hi,
the simplest way of achieving this is probably to just use a String Manipulation node followed by a String to JSON node. In the String Manipulation, just use

join("{\"key1\": {\"key2\": ", $yourjsoncolumn$, "}")

to wrap your JSON into the other objects.
Kind regards,
Alexander

Edited to fix missing { in expression.

Thank you very much for such a fast response!
String manipulation node worked amazing!
But when using String to JSON node for some reason I am constantly getting this error:

ERROR String to JSON 2:282 Execute failed: Expected end of input, but there were content after line: 1 column: 11
in row: Row0

Any tips how to resolve this problem?

Kind regards

Hi,
Yes! I forgot a “{” at the beginning. The expression should be:

join("{\"key1\": {\"key2\": ", $yourjsoncolumn$, "}")

I will also edit the original answer.
Kind regards,
Alexander

4 Likes

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