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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:34:03+00:00 2026-06-01T14:34:03+00:00

I am working with learning json right now and to get my feat wet

  • 0

I am working with learning json right now and to get my feat wet so to speak I was wondering what would be the best way to get a file with json info and populate a site with it. The file would be something like this:

window.test =
{
    "header1":
    [
        { "title": "title1", "author": "author1"},
        { "title": "title2", "author": "author2"},
        { "title": "title3", "author": "author3"}
    ],
    "header2":
    [
        { "title": "title1", "author": "author1"},
        { "title": "title1", "author": "author2"},
        { "title": "title1", "author": "author3"}
    ]
};

Then would the code be something like this?

$(function() {
    $.getJSON('jsonFile.js',function(data){
        $.each(data, function(){
            console.log(header1.title);
            console.log(header2.title);
        });
    });
});

Again I am a newbie with JSON so any tutorials, suggestions, well anything to help me understand core concepts here would help.

  • 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-01T14:34:06+00:00Added an answer on June 1, 2026 at 2:34 pm

    Your json:

    { 
        "header1": 
        [ 
            { "title": "title1", "author": "author1"}, 
            { "title": "title2", "author": "author2"}, 
            { "title": "title3", "author": "author3"} 
        ], 
        "header2": 
        [ 
            { "title": "title1", "author": "author1"}, 
            { "title": "title1", "author": "author2"}, 
            { "title": "title1", "author": "author3"} 
        ] 
    }
    

    Your code:

    $(function() {   
        $.getJSON('jsonFile.js',function(data){
    
            console.log(data.header1[0].title);   
            console.log(data.header2[0].title);     
        });   
    });  
    

    Optionally, do a each() over data.header1 and data.header2

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

Sidebar

Related Questions

I am learning latex right now as a hobby and was working on beamer
I've been working with Visual Studio 2010 Beta-2 to get some advanced learning on
I'm currently learning working with certificates and now I'm curious, if it is possible
I'm working on learning Objective-C, and I'm trying to get a feel for the
I've been working at learning programming for a while now and I feel that
I've been learning Php/SQL/JSON for just over 24 hours now and its gone pretty
I am trying to get an event calendar working from json data. I just
I'm working on learning Objective-C/Coaoa, but I've seem to have gotten a bit stuck
I am working on learning how to use git and the section I am
I am working on a small project for learning PHP better. This project has

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.