Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to read JSON in Pug NodeJs #3431

Open
FranciscoCastle opened this issue Apr 10, 2024 · 0 comments
Open

How to read JSON in Pug NodeJs #3431

FranciscoCastle opened this issue Apr 10, 2024 · 0 comments

Comments

@FranciscoCastle
Copy link

Pug Version: 3.0.2

Node Version: 21.7.1

Input JavaScript Values

let data = JSON.parse('{"memberships":{"view":0},"forms":{"view":1}}');
res.render('test',{data:data});

Input Pug

p= data.forms.view

Expected HTML

<p>1</p>

Actual HTML

<p>[object Object]</p>

Additional Comments

I have tried to access from pug a json that I sent in my response from the server to the web client, but I have not had success reading the json, is there a way to read it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant