Getting actual raw value from json body

Hi, i’m new to n8n, i was testing if i could use n8n to handle some http requests as a man in the middle for credentials validation, i have a webhook wich recieves a json, it work, but when i try to set this value into a new http request node using expression {{$node[“Set”].json[“body”]}} i get a prefix to the raw data and it results into this

[Object: {“id”:“5ef6936c7a3d2cf982409e36”,“data”:[{…

is there a way to get rid of this prefix “[Object: {” using any sort of trick in expression?

thank you, regards.

Hey @aratamagna welcome to the community. Can you share the workflow?

is there a better way tho share a workflow than pasting the raw code btw?

@aratamagna Ok, it has the object prefix cuz it’s an object.

The value of {{$node[“Set”].json[“body”]}} is the object below.

{
   "id": 5ef6936c7a3d2cf982409e36",
   "data": [{  }],
}

I’m guessing you either just want to reference the id of the data and that can be done like this

{{$node[“Set”].json[“body”][“id”]}}

{{$node[“Set”].json[“body”][“data”]}}

About sharing the workflows, yes, this is wat of sharing workflows. For something reason, the workflow you pasted had “ and ” instead of " and ". I had to replace them.

Let me know if that helps.

thanks for the reply, if instead i use {{$node[“Set”].json[“body”][“data”]}} i get the following.

[invalid (Expression is not valid: illegal character)]

after a second attempt i get the following.

[Array: [{“id”:…

is there a way to get that prefix out?

i’ve also tried this expression

{{$node[“Webhook”].json[“body”][“data”].join(’, ')}}

with this result

[object Object], [object Object]

You actually do not have to care about the [Object: ...] it will not be transmitted. It is only a visual indication that shows that it is an actually JavaScript object.
So it will already work as you expect it to work. If you however want to see it (for your visual pleasure) without it you can simply wrap it in JSON.stringify(...).

Here an example with both:

3 Likes