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

  • Home
  • SEARCH
  • 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 8109561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:27:40+00:00 2026-06-06T01:27:40+00:00

I am having a json string [{part_id:66,part_name:Palet crate,part_image:crate-box.gif,0:{language_data_content:Length [mm],pgd_value:1000},1:{language_data_content:Width [mm],pgd_value:800},2:{language_data_content:Height [mm],pgd_value:800},3:{language_data_content:Thickness [mm],pgd_value:20}}] This is

  • 0

I am having a json string

[{"part_id":"66","part_name":"Palet crate","part_image":"crate-box.gif","0":{"language_data_content":"Length [mm]","pgd_value":"1000"},"1":{"language_data_content":"Width [mm]","pgd_value":"800"},"2":{"language_data_content":"Height [mm]","pgd_value":"800"},"3":{"language_data_content":"Thickness [mm]","pgd_value":"20"}}]

This is a part of a Ajax response from my action in a controller

  for($i=0;$i<count($partlist);$i++){              
            $jsondata[$i]['part_id'] = $partlist[$i]['part_id'];
            $jsondata[$i]['part_name'] = $partlist[$i]['part_name'];
            $jsondata[$i]['part_image'] = $partlist[$i]['part_image'];
            $gdata = $pgdata->getPropertyDimensions($partlist[$i]['part_id'],1);
            if(count($gdata) > 0){
                $j = 0;
                foreach($gdata as $g){
                    $jsondata[$i][$j]['language_data_content'] = $g->language_data_content;
                    $jsondata[$i][$j]['pgd_value'] = $g->pgd_value;
                    $j++;
                }
            }           
        } 
       echo json_encode($jsondata);exit;

For one part id there can be multiple pgd_value In this json array there is only one part id and four pgd_value..on my ajax success function in looping this json as

success:function(msg){
str = '';
  if(msg.length > 0){
                for(j=0;j<msg.length;j++){
   str +='<span>'+msg[j]['part_id']+'</span>';
   // here i want to loop those four **pgd_value** values from json is it possible ?

}
}

}
  • 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-06T01:27:43+00:00Added an answer on June 6, 2026 at 1:27 am

    You can use jQuery.map to select the pgd_values. See this fiddle: http://jsfiddle.net/HackedByChinese/6LLVe/1/

    var str = '';
    if (msg.length > 0) {
        for (j = 0; j < msg.length; j++) {
            var pgdValues = $.map(msg[j], function(item) {
                if (item['pgd_value']) return item['pgd_value'];
            });
            str += '<span> Part ID ' + msg[j]['part_id'] + ' pgd_values ' + pgdValues.join(', ') + '</span>';
            // OP: here i want to loop those four **pgd_value** values from json is it possible ?
            // ME: yep. all the IDs are now accessible from `pgdValues`
    
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting JSON response from the server..Inside that JSON string i am having
I'm trying to put together something to decode a Json string and not having
I'm having a problem with deserializing a json string to a dictionary. I'm using
Having a little trouble processing my NSStrings into a valid JSON string. NSString *version
I am having a problem passing a json string back to a php script
Hi Im having trouble getting the Javascript serialiser to convert this Json string to
JSON string: '[Colour,Audio,Effect]' I'm having an issue iterating through this, albeit it's a simple
I am having trouble to parse a JSON string. The JSON is given below:
I'm having trouble implementing a script which should parse a json string from a
I'm having trouble parsing Json string to Objects in C#. I'm using this: JavaScriptSerilizer

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.