Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8885629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:21:24+00:00 2026-06-14T21:21:24+00:00

Which would be best way to do these things? Note: My array contains complex

  • 0

Which would be best way to do these things?

Note: My array contains complex values means comma separated or object values in side string array & Arrays string quoted in double quotes and elements are in single quotes.

EX. str = "['sam', 'admin', '1062', 'Sam', 'True', '$$global_permissions#1062:manage_replenishment,purchase_order,reprint_invoice#1008', 'sameer@opnce.com', '9920580', 'en', '358', '{\"Sales-tax-details\":\"brand,category,supplierNo\",\"invoice-logs\":\"invoiceNo,eventDateTime,event\"}']"

Here i played with JSON.parse,

JSON.parse(str);
Uncaught SyntaxError: Unexpected token ' // this error i got on console

Then i tried,

JSON.parse(str.replace(/'/g, '"'))
Uncaught SyntaxError: Unexpected token S  // this error i got on console

One more thing i wanted to explore here as,
if str contains following elements,

str = "['sam', 'admin', '1062', 'Sam', 'True', '$$global_permissions#1062:manage_replenishment,purchase_order,reprint_invoice#1008', 'sameer@opnce.com', '9920580', 'en', '358', '{}']"

for this str i tried,

JSON.parse(str.replace(/'/g, '"'))

Its working fine here,

Regards.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:21:25+00:00Added an answer on June 14, 2026 at 9:21 pm

    Perhaps,

    JSON.parse('["a", "b", "c"]');
    

    EDIT: For the EX. str from the question, the following should work:

    JSON.parse(str.replace(/'{/g, "{").replace(/}'/g, "}").replace(/'/g, "\"").replace(/\\\"/g, "'"))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Which is the best practice in this situation? I would like an un-initialized array
I wanted to know which would be best suitable - EDM or reflection provider
I am trying to determine which implementation of the data structure would be best
Which version of Linux would be my best choice if I want to use
I would like to ask which is the best solution for integrating google maps
What would you suggest as the best server stack for a dedicated server which
I would like to know the best way to markup scientific names in XHTML.
Which would be a more appropriate repository to host a small, XCode, Objective-C based
I have a label which would display strings from 0 ft to say 999
I was just wondering which would be cheaper, using a try catch block for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.