I am working on an online shop together with my friend. He set a cookie for me with PHP with the amount of added products to the Cart. The cookie is called "cart", and the variable with the amount of the products is called "items".

And I have to read the cookie and get the value of "cart" back with javascript and print it in the HTML document, but I have no Idea how to use it, can you please help me? I have never worked with cookies or JSON before, but I think it should be done with JSON, can you please explain it to me how it works? 

when I do : `console.log(document.cookie);`

I receive something like this: `cart=%7B%22items%22%3A%7B%228%22%3A1%7D%7D;`

And I have no idea how to encode it.

Thank you