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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:17:56+00:00 2026-06-04T17:17:56+00:00

I get invalid label error for firstname: John2, . I put my json data

  • 0

I get invalid label error for “firstname”: “John2”,.
I put my json data in parenthesis, so why am I still getting this error?
Am I still lacking something so that the code is confusing it with a java script label?

    <script type="text/javascript">
        var data = "(" + {
  "firstname": "John1",
  "lastname": "Doe",
  "location": {
    "latitude": "48.4048403957642",
    "longitude": "2.68452644348145"
  }
}
{
  "firstname": "John2",
  "lastname": "Doe",
  "location": {
    "latitude": "48.4050236871384",
    "longitude": "2.68512690051361"
  }
}
{
  "firstname": "John3",
  "lastname": "Doe",
  "location": {
    "latitude": "48.4048403957642",
    "longitude": "2.68452644348145"
  }
}
+ ")" ;

      function initialize() {
        var center = new google.maps.LatLng(48.404840395764175, 2.6845264434814453);

        var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 3,
          center: center,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        });

        var markers = [];
        for (var i = 0; i < data.length; i++) {
          var location = data[i];
          var latLng = new google.maps.LatLng(location.latitude,
              location.longitude);
          var marker = new google.maps.Marker({
            position: latLng
          });
          markers.push(marker);
        }
        var markerCluster = new MarkerClusterer(map, markers);
      }
      google.maps.event.addDomListener(window, 'load', initialize);
    </script>
  • 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-04T17:17:57+00:00Added an answer on June 4, 2026 at 5:17 pm

    You have two problems (that I can spot).

    First, you are working in JavaScript, not JSON. You have an object literal.

    Get rid of the "(" and ")" entirely. Those are used if you are trying to parse JSON using eval. You don’t have JSON and if you did you should use the JSON object (and its parse method), not eval. Currently, you are trying to stringify the object (which would give you something like "([Object object])", which wouldn’t be any use at all).

    Second, you appear to be trying to work with an array of objects, but you have just placed them one after the other.

    Wrap your objects with an array literal [ and ].

    Separate the items in the array with commas (,).

    The reason for the error message is that you have created such a weird parse state that the JS engine things you are trying to label a loop.

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

Sidebar

Related Questions

When I run this code I get the following error error: invalid label html_attributions
I am getting the invalid label error now I have upgraded my jQuery. I
i get the error invalid label {ok : 1, msg : Uh, we had
I'm getting an 'Invalid XML Data' error for any Fusion Chart which contains a
I've searched all over and tried everything but I still get: invalid multibyte char
when I seem to use parameters in my query, I get an error Invalid
I keep getting an invalid_grant error on trying to get an OAuth token from
I get error: ORA-06575: Package or function GET_CONC_NAMES is in an invalid state When
With GCC 4.1.2, I get the error tmp.cpp:8: error: invalid function declaration for the
When compiling my project, I get the error: Error: D:\Programming\Projects\Aprovado\examwindow.cpp:6: error: invalid use of

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.