On the server I'm storing a JSON object as a cookie (using Django / json.dumps), it looks like so:

```
'{"name": "Simon", "gender": "M"}'

```

On the client when I run document.cookie I can see the cookie and it looks like so:

```
"user="{\"name\": \"Simon\"\054 \"gender\": \"M\"}";

```

I have a small function which retrieves a cookie by name ( getCookie('user') )it returns a string:

```
"{\"name\": \"Simon\"\054 \"gender\": \"M\"}"

```

I want to parse this back to a JSON object for further use on the client however JSON.parse() returns the error: "SyntaxError: Unexpected number".

Whats strange is if you run the following: 

```
JSON.parse("{\"name\": \"Simon\"\054 \"gender\": \"M\"}") 

```

directly in the console it works fine. Any ideas?

If there is a better way to store the cookie etc im open to ideas

Thanks in advance.