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

233
Views
How to display a variable that is injected in json file in Vue

I have a JSON file and I'm using its content to dynamically render the text inside a box. The content of the box changes when the page is first mounted, and with hover over some buttons, etc. in the page.

The problem is, the text in the JSON can also be dynamic. For example:

.
.
.
"tips": {
    "home": {
        "general": "Welcome to ${testPage}"!,
        "button1": "Click this button to log in."
    }
}
.
.
.

The Vue template is like this (there can also be HTML code in the JSON text, so I use v-html):

<div v-html="tips.home.general"></div>

Also tried like this, didn't work:

<div>{{tips.home.general}}</div>

And the testPage variable is defined like this in the component for now (later, it will be a dynamic value I'll get from the backend):

    data: () => ({
      testPage: 'test demo page name'
    })

Everything works great, except I can't get Vue to read this "testPage" variable as a variable. It just renders the text "${testPage}".

I solved this problem before in JSP by just adding the variable name in JSON like <%= testPage %>, but a similar approach doesn't work here.

Is there a way that it can be done in Vue?

about 4 years ago · Juan Pablo Isaza
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!