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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:34:58+00:00 2026-06-03T06:34:58+00:00

I have a JSON data [ { Name: Tom, Email: tom@gmail.com, Notes: Yea, it’s

  • 0

I have a JSON data

[
    {
        "Name": "Tom",
        "Email": "tom@gmail.com",
        "Notes": "Yea, it's good",
        "Ratings": "5",
        "Messages": [
            "Tom - I am good",
            "System - How're you doing?",
            "Tom - True, that!",
            "System - Oh Yes! ;) "
        ]
    },
    {
        "Name": "Sunny",
        "Email": "sunny@gmail.com",
        "Notes": "Yea, it's good",
        "Ratings": "2",
        "Messages": [
            "Sunny-I am good",
            "System - How're you doing?",
            "Sunny - True, that!",
            "System - Oh Yes! ;) "
        ]
    }
]

I am parsing it using jQuery and iterating it like this;

            var jsonData = $("#jsonData").val();
            var plainData = $.parseJSON(jsonData);

            for (var j = 0; j < plainData.length; j++) {
                var Name = plainData[j].Name;
                var Email = plainData[j].Email;
                var Notes = plainData[j].Notes;
                var Ratings = plainData[j].Ratings;

                var Messages = plainData[j].Messages;
                var _messages = " ";
                for (var i = 0; i < Messages.length; i++)
                    _messages += Messages[i] + "\n";

            }

I’m not too sure if iterating this in a for loop is a good idea. Could anyone please suggest me a better/optimized way to iterate the parsed json value?

  • 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-03T06:34:59+00:00Added an answer on June 3, 2026 at 6:34 am

    The way you’re doing it just now is the most efficient way to do it, except:

    var Messages = plainData[j].Messages;
    var _messages = " ";
    for (var i = 0; i < Messages.length; i++)
        _messages += Messages[i] + "\n";
    

    Could also be written better as :

    _messages = plainData[j].Messages.join('\n') + '\n';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a json output array like this { data: [ { name: Ben
Let say I have json data like data = {id:1, name:abc, address: {streetName:cde, streetId:2
I have my json data as follows: var Data = [{Name:a1,ID:b1, year:2011}, {Name:a2, ID:b2,
I have a json data in this format. ({test:[test, &lt;br/&gt;&lt;div&gt;&lt;b&gt;Name&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; James;/div&gt;&lt;div&gt;&lt;b&gt;Company&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Company1&lt;/div&gt;&lt;div&gt;&lt;b&gt;Phone.....}). I need to
I have a json string { to: { data: [ { name: f8, id:
I have the following json data: { data: [ { name: The Frugalicious Chef,
hello all i have a json file i.e { data: [ { name: The
I have a JSON object { data: [{ user_id:1, user_name:test, user_phone:2147483647, user_email:test@example.com }] }
I have some JSON data that looks like this: { data: [{ name:John Smith,
I have JSON data like this: [{id:3,name:jason},{id:4,name:karen}] I want to build a table view

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.