ODBMCopy beahvior

Issue #3 resolved
Katie Wildflower created an issue

An invocation of ODBMCopy like

ODBMCopy(['/Logger', '/Runinfo'], undefined, "json")

currently returns a string like "[ {...}, {...} ]"; the square braces on the outside prevent the use of JSON.parse to parse the string, as this isn't proper JSON. I would have expected a return string like

{"Logger" : {...}, "Runinfo" : {...} }

which would be JSON-parsable. Another alternative would be for ODBMCopy to return an actual array whose elements are the strings describing the data as it is now - then JSON.parse could parse the elements of the array. @dd1 , the example on the MidasWiki under Mhttpd.js seems to suffer from the same problem - what am I missing here?

Comments (4)

  1. Katie Wildflower reporter

    Update: the top level array brackets are fine, my bad, and this function works fine in simple examples - but if I hand it a particular (large) subdirectory from my ODB tree, JSON.parse 'ing the result yields an unexpected token syntax error; currently tracking down more specific cause for this bug.

  2. Katie Wildflower reporter

    Update: the error is occurring when a floating point number in the ODB has a value of NAN. The string 'nan' is just propagating into the JSON string, which seems to cause problems; if an int is NAN, it gets chewed up into a 0, which doesn't trip up the JSON.

  3. Log in to comment