Honchar Denys
Honchar Denys

Reputation: 1508

SWIG json object parse into Client Side json

I am using Angularjs, but i guess it can be simple JavaScript.

What I have done:

console.log(JSON.parse({{{JSON.stringify(items)}}}));

items has the JSON object. I am getting the error:

Uncaught SyntaxError: Unexpected token o`.

I am not sure if it's the correct way to do this. Any idea?

Upvotes: 1

Views: 212

Answers (1)

Honchar Denys
Honchar Denys

Reputation: 1508

I have figured it out:

{{{items|raw|json_encode}}}

Upvotes: 1

Related Questions