Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
349 views
in Technique[技术] by (71.8m points)

ejs - Render only certain values of JSON in table format

I am new to working with ejs, and I would like to render only certain values of my JSON in a table through using ejs. This is currently how I am rendering my JSON, and although I am only specifying name, it is returning all values

<%= data !== 'name' ? data : '' %>

I would like to return values as follows:

icon | filter 1 name | category name all side by side.

Does anyone know if this is a possibility with ejs?

Here are some relevant lines of code that might provide some additional context

backend:

const data = JSON.stringify(results, null, 2)
  console.log(results.technologies[0].name)

Front end:

try {
                    const data = await fetch('/', {
                        method: 'POST',
                        headers: {
                            'Content-Type': 'application/json'
                        },
                        body: JSON.stringify({
                            url: url
                        })


                    }).then(res => {
                        document.open()
                        res.text().then(function(text) {

                            document.write(text)
                        });
question from:https://stackoverflow.com/questions/65854552/render-only-certain-values-of-json-in-table-format

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...