• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

195
Views
Convert no quoted dictionary keys to double quoted keys in JS

I have json format string that has keys without inverted commas. So I am not able to parse this string to json using var jsonV = JSON.parse(fileStr). How can I put the keys of dictionary into inverted commas and then parse the string to json? Below is the example string I want to parse into json.

{
  title: 'Service Requests',
  navTitle: 'Service Requests',
  headers: {
    id: 'ID',
    priority: 'Priority',
    status: 'Status',
  },
}

I am getting this as string only. I want to parse this into JSON.

Edit: I tried this and this links. But none of these answered my question. These doesn't take the condition that if we have only string having json elements without inverted commas like in below example. (I cant even iterated through this string object as)

about 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error