How to output the contents of an array, and not just the word "Array"

In the output, where the goods are labeled “array”, but there is no content of this array Скриншот 29-08-2022 11:06:09.jpg . Tell me how it is possible to output the contents of this array and then work with it, but it is better to return it to the request.

Thanks

Hi @anton11122211

First off, welcome to the Pipedream community. Happy to have you!

Thanks for the screenshot. Have you verified that your Node.js step is actually setting an array in the body of your response?

If an array was passed there, the response would attempt to JSON serialize the array. The string "Array" means that there must be an issue with the type of data being passed at that key.

Thanks for the answer @pierce !

That’s right I got it:

  1. do I have an error in the array?
  2. if there is an error, how can I fix it \ see it?

Hi @anton11122211

I don’t know the source of this data, but here’s two ways to inspect data in your workflow:

  1. Use the step exports to inspect data as it moves from step to step during your workflow’s execution
  2. You can use console.log to view data just like you would in a Node.js or Javascript script.

Thanks for the answer @pierce !

Unfortunately, it was not possible to decompose the answer 2.42 MB file on MEGA

I’m using php, yes I see the array I’m sending. But I would like to see it here)

Maybe I don’t understand

Hi @anton11122211

Thanks for the screenshare, that’s very helpful to follow along.

Pipedream supports multi-dimensional complex JSON objects, that’s not the issue I assure you.

Supporting a custom application is outside of the scope of support we can offer. But I recommend you take a look at the structure of the PHP object you’re trying to serialize into JSON.

It’s most likely an issue with serialization before the payload is sent to your Pipedream webhook.

Thanks for the answer @pierce !

is my problem that I have an erroneous array?

Can you give me the correct multidimensional array, please

Yes, that is the most likely cause.

Please refer to the PHP language website to learn more about how to encode PHP arrays into JSON objects, or search StackOverflow.

Or you can contact a Pipedream Partner to assist you with your workflow.

Can you show me? how to output this array. my output is not correct ( Скриншот 02-09-2022 00:20:21.jpg ):

$datePost = [
    'test1' => 1,
    'test2' => 1,
    'test3' => 1,
    'test4' => [
        'test5' => 11,
        'test6' => 11,
        'test7' => 11,
    ],
    ["Tom", "Alice"],
    ["Bob", "Kate"]
];

Thanks

Hi @anton11122211

Sorry, this is not a PHP support community, but I recommend you post your question on how to encode JSON properly with PHP on StackOverflow:

You might be able to get an answer from the PHP community there. Best of luck!

If you’re just looking to output the contents of an array and not the word “Array”, there are a few different ways you can do this. One way would be to use the print_r() function:

$my_array = array(‘one’, ‘two’, ‘three’);
print_r($my_array);

This will output the contents of the array like so: Array ( [0] => one [1] => two [2] => three )

Alternatively, you could use a foreach loop:

foreach ($my_array as $element) {
echo $element; // or do whatever you want with each element here!
}

Hope this helps

Eddie