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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:43:42+00:00 2026-05-18T00:43:42+00:00

I am parsing a json string like so: ring = JSON.parse(response); Now, ring is

  • 0

I am parsing a json string like so:

ring = JSON.parse(response);

Now, ring is an object but ring.stones is just a string when it should be an object as well.

If I call:

ring.stones = JSON.parse(ring.stones);

It is now the correct object.

I didn’t know if this is correct behavior or if maybe I have an issue somewhere stopping it from parsing recursively? If it is supposed to parse recursively, are there any known issues that would prevent it?


Update

Here is the full response before parsing:

{“ring_id”:”9″,”stone_count”:”4″,”style_number”:”style 4″,”syn10″:”436.15″,”gen10″:”489.39″,”syn14″:”627.60″,”gen14″:”680.85″,”available”:”yes”,”type”:”ring”,”engravings_count”:”0″,”engravings_char_count”:”0″,”engravings_band”:”10″,”stones”:”[{\”stone_id\”:\”27\”,\”ring_id\”:\”9\”,\”stone_shape\”:\”round\”,\”stone_x\”:\”132.80\”,\”stone_y\”:\”114.50\”,\”stone_width\”:\”71.60\”,\”stone_height\”:\”71.60\”,\”stone_rotation\”:\”0.00\”,\”stone_number\”:\”1\”,\”stone_mm_width\”:\”5.00\”,\”stone_mm_height\”:\”5.00\”},{\”stone_id\”:\”28\”,\”ring_id\”:\”9\”,\”stone_shape\”:\”round\”,\”stone_x\”:\”100.50\”,\”stone_y\”:\”166.20\”,\”stone_width\”:\”36.20\”,\”stone_height\”:\”36.60\”,\”stone_rotation\”:\”0.00\”,\”stone_number\”:\”2\”,\”stone_mm_width\”:\”2.50\”,\”stone_mm_height\”:\”2.50\”},{\”stone_id\”:\”29\”,\”ring_id\”:\”9\”,\”stone_shape\”:\”round\”,\”stone_x\”:\”200.20\”,\”stone_y\”:\”105.10\”,\”stone_width\”:\”33.90\”,\”stone_height\”:\”33.90\”,\”stone_rotation\”:\”0.00\”,\”stone_number\”:\”3\”,\”stone_mm_width\”:\”2.50\”,\”stone_mm_height\”:\”2.50\”},{\”stone_id\”:\”30\”,\”ring_id\”:\”9\”,\”stone_shape\”:\”round\”,\”stone_x\”:\”165.80\”,\”stone_y\”:\”82.50\”,\”stone_width\”:\”35.50\”,\”stone_height\”:\”33.90\”,\”stone_rotation\”:\”0.00\”,\”stone_number\”:\”4\”,\”stone_mm_width\”:\”2.50\”,\”stone_mm_height\”:\”2.50\”}]”,”images”:”[{\”title\”:\”white gold\”,\”source\”:\”Style4_4_W_M.png\”},{\”title\”:\”yellow gold\”,\”source\”:\”Style4_4_Y_M.png\”}]”}


Update 2

Based on mikerobi’s answer I was able to figure out what was happening:

Here is where I encoded it:

$row = $sth->fetch(PDO::FETCH_ASSOC);

$row['stones'] = getStones($ring_id);
$row['images'] = getRingVariations($ring_id);

return json_encode($row);

But the functions getStones and getRingVariations were returning json_encode‘d strings. I needed to change them to return plain strings.

  • 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-18T00:43:42+00:00Added an answer on May 18, 2026 at 12:43 am

    Your JSON structure is wrong, it is wrapping stones in quotes, turning it into a string.

    Your JSON looks like:

    {
        stones: "[{\"stone_id":\"27\"},{\"stone_id\":\"27\"}]"
    }
    

    It should look like:

    {
        stones: [{"stone_id": 27},{"stone_id": 27}]
    }
    

    EDIT

    It appears you are converting all values to string, including numbers, I updated my example to reflect this.

    Also, I’m guessing by the output that you are writing your own code to serialize the JSON, I highly recommend using an existing library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to be able to parse a string of JSON representing an object
I am parsing a JSON string: Response: {success:false,displaymessage:UserName or Email already exist. Please try
I am parsing a JSON response from Citrix' web services. The response looks like
For parsing JSON like this twitter API users/show response I've been using Jackson and
When Parsing JSON I normally just constuct an object and use the gson library
I am receiving JSON string response from my WCF service. I wanna parse this
I'm having a hard time parsing the below JSON string on iOS 5. {States:
I got below JSON string, i facing issue parsing because it contains non english
I am currently trying to pass a generated JSON string to dojo for parsing
I'm parsing some json to return a basic string token or error message. -

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.