Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-1941

serverStatus Date() is not JSON, therefore it is not JSON parsable

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • 1.6.3
    • 1.7.3
    • None
    • None
    • ALL

    Description

      While creating a collector for graphing in ZenOSS using the serverStatus?text url, it was found that the resulting output is merely JSON-like and not actually JSON.

      { "version" : "1.6.3",
      "uptime" : 4712,
      "uptimeEstimate" : 3844,
      "localTime" : Date( "Wed Oct 13 20:52:15 2010" ),
      ...

      Python's simplejson and json modules cannot load this due to the Date( "" ) which is not valid JSON. However, simplejson DOES support ISO datetimes, as per one of the answers found here: http://stackoverflow.com/questions/455580/json-datetime-between-python-and-javascript .

      So, either the date needs to be returned as an ISO datetime string, or it needs to become an actual object like:

      {"localTime":

      { "date" : "Wed Oct 13 20:52:15 2010" ) }

      }

      Otherwise, to parse this in Python, one has to manually remove the Date( ) wrapper around the string, which I am doing for now, but would like to not do.

      Attachments

        Activity

          People

            mathias@mongodb.com Mathias Stearn
            merlin Merlin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: