# Unserialize an array

**URL:** <https://community.n8n.io/t/unserialize-an-array/3880>\
**Category:** Questions\
**Created:** [January 18, 2021, 7:01pm UTC](https://community.n8n.io/t/unserialize-an-array/3880 "2021-01-18T19:01:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![gravitoad](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gravitoad/32/2246_2.png) [@gravitoad](https://community.n8n.io/u/gravitoad)\
**Post date:** [January 18, 2021, 7:01pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/1 "2021-01-18T19:01:30Z")

</div>

Hey All,

This should be pretty straight forward, but I can’t find any info on it at all. I just need to turn the following into json.

```
[
   {
      "gallery": "a:2:{i:0;s:4:"1887";i:1;s:4:"1882";}"
   }
]

```

Thanks for all the help, and the ongoing development of this project, it’s been amazingly helpful!

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [January 18, 2021, 7:22pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/2 "2021-01-18T19:22:53Z")

</div>

Sadly honestly no idea how that would work. Have never seen that format in my life or how that data would look unserialized. What is “serializing” like that?

---

<div class="post-metadata">

**Author:** ![gravitoad](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gravitoad/32/2246_2.png) [@gravitoad](https://community.n8n.io/u/gravitoad)\
**Post date:** [January 18, 2021, 7:25pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/3 "2021-01-18T19:25:00Z")

</div>

It’s coming from an ACF field in Wordpress. It’s several image IDs. Perhaps I need to look at how they were entered in the first place. From what I could tell, I thought it was serialized PHP.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [January 18, 2021, 7:45pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/4 "2021-01-18T19:45:20Z")

</div>

Ah interesting. You can try what they describe here:

> **[PHP's unserialize in JavaScript](https://locutus.io/php/var/unserialize/)**
>
> Here’s what our current JavaScript equivalent to PHP's unserialize looks like.

---

<div class="post-metadata">

**Author:** ![gravitoad](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gravitoad/32/2246_2.png) [@gravitoad](https://community.n8n.io/u/gravitoad)\
**Post date:** [January 18, 2021, 7:52pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/5 "2021-01-18T19:52:17Z")

</div>

Cool, I’ll look into that. Thanks again, you all rock!

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [January 18, 2021, 8:33pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/6 "2021-01-18T20:33:26Z")

</div>

You are welcome. Great to hear! Have fun!

---

<div class="post-metadata">

**Author:** ![Roket](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/roket/32/475_2.png) [@Roket](https://community.n8n.io/u/Roket)\
**Post date:** [June 28, 2021, 2:17pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/7 "2021-06-28T14:17:31Z")

</div>

@jan , you can give an example of a function node that uses the code from the [link](https://locutus.io/php/var/unserialize/)? I was unable to start it. There is no error, all objects are simply returned.

My data example:

 ![n8n - Google Chrome 2](https://europe1.discourse-cdn.com/n8n/original/2X/e/e3938d1185674f9ac9aa3ecd2d89d72c1428c5fc.jpeg)

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [June 28, 2021, 2:35pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/8 "2021-06-28T14:35:49Z")

</div>

That is a npm package. Assuming that you are using docker to run n8n, you can follow the steps in the post bellow to create an image that includes that npm packages. With that, you are gonna be able to require the library in the function node.

> [@Socks5 support in http request node?](http://community.n8n.io/t/socks5-support-in-http-request-node/6301/4):
>
> Yes, but again, you have to: Add the library socks5-http-client to /n8n/packages/nodes-base/package.json Reference the [custom](https://github.com/n8n-io/n8n/tree/master/docker/images/n8n-custom) image in the docker-compose file. Set the env variable NODE\_FUNCTION\_ALLOW\_EXTERNAL=socks5-http-client Require and use the library within the function node.

---

<div class="post-metadata">

**Author:** ![Roket](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/roket/32/475_2.png) [@Roket](https://community.n8n.io/u/Roket)\
**Post date:** [June 28, 2021, 2:41pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/9 "2021-06-28T14:41:43Z")

</div>

@RicardoE105, thanks for the answer, now I will try to do it.

---

<div class="post-metadata">

**Author:** ![Roket](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/roket/32/475_2.png) [@Roket](https://community.n8n.io/u/Roket)\
**Post date:** [June 28, 2021, 3:48pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/10 "2021-06-28T15:48:43Z")

</div>

@RicardoE105, I have the “NODE\_FUNCTION\_ALLOW\_EXTERNAL” parameter in the portainer with the “uuid” value.  
What do we have to do? Create the second parameter “NODE\_FUNCTION\_ALLOW\_EXTERNAL” with the value “what value should I specify here?”

 ![Portainer - Google Chrome 2021-06-28 20.16.14](https://europe1.discourse-cdn.com/n8n/original/2X/3/3659d976c19694da85e1dedca2a020c853beb8a4.jpeg)

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [June 28, 2021, 4:02pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/11 "2021-06-28T16:02:09Z")

</div>

You can have multiple values separated by commas, for example, uuid,request,moment.

---

<div class="post-metadata">

**Author:** ![Roket](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/roket/32/475_2.png) [@Roket](https://community.n8n.io/u/Roket)\
**Post date:** [June 28, 2021, 4:08pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/12 "2021-06-28T16:08:06Z")

</div>

@RicardoE105, and what to enter in this parameter together with “uuid”? As I understand it, the example [link](http://community.n8n.io/t/socks5-support-in-http-request-node/6301/4) to which you indicated is not my case, but only a similar one.

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [June 28, 2021, 4:16pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/13 "2021-06-28T16:16:23Z")

</div>

That depends on the npm package that you want to use. If you want to use the one you shared above, then it should be “uuid, locutus”.

---

<div class="post-metadata">

**Author:** ![Roket](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/roket/32/475_2.png) [@Roket](https://community.n8n.io/u/Roket)\
**Post date:** [June 28, 2021, 4:20pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/14 "2021-06-28T16:20:44Z")

</div>

@RicardoE105, а few more questions:

 ![Socks5 support in http request node_ - Questions -](https://europe1.discourse-cdn.com/n8n/original/2X/e/e8f627e1f972e8ccfc69ec5b068acaab35f64740.jpeg)

---

<div class="post-metadata">

**Author:** ![Roket](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/roket/32/475_2.png) [@Roket](https://community.n8n.io/u/Roket)\
**Post date:** [June 28, 2021, 4:21pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/15 "2021-06-28T16:21:48Z")

</div>

On the third point “OK”

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [June 28, 2021, 4:23pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/16 "2021-06-28T16:23:31Z")

</div>

To add the library you can either add it manually to the package.json or you can do a `npm install locutus --save`

---

<div class="post-metadata">

**Author:** ![Roket](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/roket/32/475_2.png) [@Roket](https://community.n8n.io/u/Roket)\
**Post date:** [June 28, 2021, 4:24pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/17 "2021-06-28T16:24:34Z")

</div>

The second point is also not understood.  
In the console, entered “docker build -t n8n-custom -f docker / images / n8n-custom / Dockerfile” and got this:

 ![WhatsApp - Google Chrome 2021-06-28 21.23.19](https://europe1.discourse-cdn.com/n8n/original/2X/7/73cd6ad432e5dd49afbc809b7e6a965fa76ef810.jpeg)

---

<div class="post-metadata">

**Author:** ![Roket](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/roket/32/475_2.png) [@Roket](https://community.n8n.io/u/Roket)\
**Post date:** [June 28, 2021, 5:17pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/18 "2021-06-28T17:17:51Z")

</div>

This point “OK”

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [June 28, 2021, 11:27pm UTC](https://community.n8n.io/t/unserialize-an-array/3880/19 "2021-06-28T23:27:37Z")

</div>

In the second step, you have to create the docker-compose below. Of course, you have to modify the variables with your data.

```
version: "3"

services:
  traefik:
    image: "traefik"
    restart: always
    command:
      - "--api=true"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
      - "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
      - "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
    ports:
      - "443:443"
    volumes:
      - ${DATA_FOLDER}/letsencrypt:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock:ro

  n8n:
    image: n8nio/n8n
    restart: always
    ports:
      - "127.0.0.1:5678:5678"
    labels:
      - traefik.enable=true
      - traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
      - traefik.http.routers.n8n.tls=true
      - traefik.http.routers.n8n.entrypoints=websecure
      - traefik.http.routers.n8n.tls.certresolver=mytlschallenge
      - traefik.http.middlewares.n8n.headers.SSLRedirect=true
      - traefik.http.middlewares.n8n.headers.STSSeconds=315360000
      - traefik.http.middlewares.n8n.headers.browserXSSFilter=true
      - traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
      - traefik.http.middlewares.n8n.headers.forceSTSHeader=true
      - traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
      - traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
      - traefik.http.middlewares.n8n.headers.STSPreload=true
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER
      - N8N_BASIC_AUTH_PASSWORD
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_TUNNEL_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ${DATA_FOLDER}/.n8n:/root/.n8n
```

---

<div class="post-metadata">

**Author:** ![Roket](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/roket/32/475_2.png) [@Roket](https://community.n8n.io/u/Roket)\
**Post date:** [June 30, 2021, 8:23am UTC](https://community.n8n.io/t/unserialize-an-array/3880/20 "2021-06-30T08:23:35Z")

</div>

@RicardoE105, thanks for the help! Everything works perfectly!
