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 1058699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:03:43+00:00 2026-05-16T18:03:43+00:00

I am getting a string like this: var json = title: abc, link: http://google.com,

  • 0

I am getting a string like this:

var json = "title: abc, link: http://google.com, size: 1";

How can I convert it to an Javascript object so that I can access it like obj.title, obj.link etc. This doesn’t work:

var obj = eval("(" + json + ')');  //error

How to achieve this?

Here is the full code

var entry = json.feed.entry[i];
//here entry = title: abc, link: http://google.com, size: 1
entry = entry.content.$t.replace(/: /g, '": "');
entry = entry.replace(/, /g, '", "');
entry = '"' + entry + '"';

var jdata = eval("(" + entry + ')'); //error: missing ) in parenthetical
  • 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-05-16T18:03:44+00:00Added an answer on May 16, 2026 at 6:03 pm

    Use the jQuery.parseJSON()
    And your json string is not valid! You have to doublequote.

    var obj = jQuery.parseJSON('{' + '"title": "abc", "link": "http://google.com", "size": 1' + '}');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting JSON string from website. I have data which looks like this
How can i get Image tag from html String. I am getting description like
I have this bit of javascript: var jsonString = some string of json; $.post('proxy.php',
I wrote following code...but i am getting Error like: Error 1 'LoginDLL.Class1.Login(string, string, string)':
This is driving me nuts! I'm getting some JSON from my server: {id262:{done:null,status:null,verfall:null,id:262,bid:20044,art:owner,uid:demo02,aktion:null,termin_datum:null,docid:null,gruppenid:null,news:newsstring,datum:11.06.2010,header:headerstring,for_uid:demo01}, id263:{done:null,status:pending,verfall:null,bid:20044,id:263,uid:demo02,art:foo,aktion:dosomething,termin_datum:11.06.2010,docid:null,gruppenid:null,datum:11.06.2010,news:newsstring,for_uid:demo01,header:headerstring},
I'm calling web service (my web service) like this: var request = WebRequest.Create(Options.ServerUri +
i have a webservice that is returning this response : <string xmlns=http://tempuri.org/>{ Head:[ {
my json string is as follows: var data = [{first:3,second:1},{first:5,second:5},{first:7,second:1}]; Now i am calling
I am generating a URL using Timestamp like this : var writeDate = function(){
I'm doing some string replacement on text I'm getting back from a JSON web

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.