Get only the payload value out of an array

#1

Hi there please help:

i have a select from mysql database that returns as follows:

i need to POST to a webcollector and i need to isolate only the datainject string

i want to use the flow below but i need to know what to put in the function node for this to work please

#2

Not sure what you are asking, but do you mean you need to convert the datainject string to json ?
If so, attach a json node, which will parse it to an object.

#3

Thank you for replying, i want to send only the value in my datainject object to the API connector.

at the moment this value is in an the datainject object in the array

could you give me the node type and the commands to achieve this - i put a change node in my flow but not sure how to use it in this case

#4

The working with messages page in the documentation explains how to use the dining to get the right path to the string and you can then use that change node to move the string to being msg.payload

#5

Do you mean you want to get the whole datainject string (which is the value of the datainject object) or do you mean you want to get the contents of the value field in that string? That is 5560 in the example you posted.
If the former then you just need to use a Change node to move the string into the payload (see the link provided earlier to see how to do that). If the latter then you can first move the string into the payload using a Change node, then feed it through a Json node, which will convert the string to a javascript object, then use another Change node to move the value field into the payload.

#6

Thank you for your advice gentlemen

i wanted the whole string and my solution was to use a change node as follows: