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

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

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.7.3
    • Affects Version/s: 1.6.3
    • Component/s: None
    • None
    • ALL

      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.

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

              Created:
              Updated:
              Resolved: