Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

163
Views
get data from internal JSON file

Hey i want to get the data from my json file and then display it in html, but first i will just console.log it. how do i exactly do that?? the json file will be updated as its the users input

varer.json

[{"id":"aa","varer":"aa","pris":""},{"id":"aa","varer":"aa","pris":""}]

varer-controller

const varerModel = require("./../models/varer");
const express = require("express");
const router = express.Router();


router.get("/getproducts", (req, res) =>{
    var products = JSON.parse(varerModel)    
    console.log(products)
    res.send(products)
   })
   
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You don't need to JSON.parse as it's already a JSON and can be directly used.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!