0 Replies Latest reply on Nov 8, 2011 2:28 PM by pcrook

    digesting json and xml with languages other than python

    pcrook

      I wanted to share so that others desiring to use their language of choice other than python don't go through the WTF I did when trying to figure out why JSON and XML parsing modules failed to read the output fromt he webAPI.  When a query is returned from the API, it first returns a code.  If the query is successful, for most queries, it returns 'OK:\n'.

      So for JSON, one might expect to see:

      [ { "EPOComputerProperties.ComputerName" : "EXAMPECOMPUTER", "EPOComputerProperties.DomainName" : "TEST", etc, etc, etc....}

       

      instead you will get:

      OK:

      [ { "EPOComputerProperties.ComputerName" : "EXAMPECOMPUTER", "EPOComputerProperties.DomainName" : "TEST", etc, etc, etc....}

       

      For XML, instead of:

      <?xml version="1.0" encoding="UTF-8"?><result>

      you get:

      OK:

      <?xml version="1.0" encoding="UTF-8"?><result>

       

      for perl, cleaning this up for digestion is easy...

      $result=~s/^OK:\n//;

      $result=~s/^\s+//;