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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:19:43+00:00 2026-05-31T09:19:43+00:00

I have a json string that I parse and then access the properties of

  • 0

I have a json string that I parse and then access the properties of the object with the dot notation. However, in the google closure compiler, the dot notation (MyObject.PropertyName) gives warning that the property isn’t defined.

For now, the solution I’m using is to convert my code into bracket notation (MyObject['PropertyName']). This removes the warning but also prevents the compiler from doing its job. On the other hand, when I write JSON.stringify(MyObject), the server receives a string with property names that are understandable.

So my question is how do we best use the google compiler in advanced mode when working with json objects that are deserialized and serialized at runtime.

  • 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-05-31T09:19:44+00:00Added an answer on May 31, 2026 at 9:19 am

    If the only JavaScript you are going to write is accessing external json, then it defeats the point of using the compiler. However, if you have even a trivial amount of JavaScript which does work besides parsing your json into domain models then the compiler may be useful.

    In our parsers we access our data via bracket notation so we can get the data properly. From there we stuff the data into our own models, which we use the . notation on. These get wildly renamed, gives us type checking and all of that goodness.

    Edit>>
    For data I use the XHRManager. This is one seriously nice class. When I get a data event from that pool I handle it as follows.

    /**
     * @private
     * @param {goog.events.Event} evt The event recieved from the XhrIo.
     */
    mypath.MyClass.prototype.onDataRecieved_ = function(evt) {
      if (evt.type != 'complete') return;
      var xhrIo = evt.target;
      var data = xhrIo.getResponseJson();
      //do somethign!
    };
    

    I have to warn you, my XHRManager handling still leaves a fair bit to be desired. I only refactored my code last week to start using it.

    For parsing I do this: (This is some raw stuff from my code base, so ignore some of the ugly.)

    our.class.path.ContestJsonParser.prototype.setContestProperties =
        function(contest, element) {
      contest.setName(element['description']);
      /**
         * @type {!number}
         */
      var timeAsInt = element['startTime'];
      contest.setScheduledStartTime(timeAsInt);
      var clockModel = contest.getClockModel();
      if (goog.isDefAndNotNull(element['period'])) {
        clockModel.setMatchState(element['period']['periodName']);
        clockModel.setStateStartTime(element['period']['periodStartTime']);
      }
      //TODO (Johan) this needs to change today to consider the rest of the stats
      //information
      var stats = element['statistics'];
      if (goog.isObject(stats) && goog.isDefAndNotNull(stats['score'])) {
        var score = stats['score'];
        contest.setMatchScore(score['home'], score['away']);
      } else {
        contest.setMatchScore(undefined, undefined); // clears score.
      }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the follow string that I need to parse, and then run it
I have the following string output_string = [10, 10, [1,2,3,4,5], [10,20,30,40,50]] Then I JSON.parse
I have one JSON that is coming in a string format. I need to
I have a JSON string which I can parse with Corona SDK. What I
I have some HTML that contains a JSON string. In the on DOM ready
I have the following controller code that returns a Json list object to my
I have some json formatted data that I parse with JSON.parse. The problem I
I have a spring action that I am rendering some json from the controller,
I have a json string saved in my db. When i retrieve it from
I have converted my Datatable to json string use the following method... public string

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.