ODBMCopy beahvior
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)
-
reporter -
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.
-
Fixed. See MIDAS forum thread https://midas.triumf.ca/elog/Midas/918
-
- changed status to resolved
- Log in to comment
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.