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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T21:04:30+00:00 2026-06-18T21:04:30+00:00

I get a JSON file via jQuery $.getJSON(url, function(data) { … and want to

  • 0

I get a JSON file via jQuery $.getJSON(url, function(data) { …
and want to parse it with either

var obj = JSON.parse(data);

or

var obj = jQuery.parseJSON(data);

The first line gives me “syntax error” (using IE8, should support JSON.parse), the second gives me “‘center’ is null or not an object”.

This is the valid JSON file I’m using:

{
"center":{"lat":"51.99637","lon":"13.07520"},
"locations":
[
    { "name":"a string","info":"another string" },
    ... some more here ...
]
}

I’m not too familiar with Javascript. What am I doing wrong?

If I use a simple JSON array (= just the content of locations) I get valid data with $.each.
Do I have to do something with data before I can use JSON.parse on it?

  • 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-18T21:04:31+00:00Added an answer on June 18, 2026 at 9:04 pm

    The problem is that the name of the function is slightly misleading : it doesn’t give you JSON but already a parsed object. What it does is fetch some JSON and parse it for you.

    data is a plain javascript object, you don’t need to parse it.

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

Sidebar

Related Questions

This works fine: var vm = {}; $.getJSON('file.json', function (data) { vm.objects = data;
I'm trying to load a .json file with this line: $.getJSON('engines.json',{},function(data){ alert(data); }); If
I have a function hitting a JSON file, and I am trying to get
I'm trying to get some JSON data from a url like this: $url =
I have a function to check if a file exists via jQuery which makes
i'm trying to include a JSON file generated by YQL via jQuery following this
I have a json file that I'm trying to get values out of. One
I need a little help with navigating a json file. I'm looking to get
In my project ,I get json data from Server,there's a field named 'creat_at' in
How do you assign the data fetched via getJSON() to an array, for later

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.