Comment 1 for bug 2029482

Revision history for this message
Andrew Johnson (anj) wrote :

The version of yajl that comes with Base and later can generate JSON5 which handles infinities and NaN values, but it looks like the pvAccess code in pvget isn't enabling that option in the print formatter. Applying the following patch to modules/pvData should fix it:

diff --git a/src/factory/printer.cpp b/src/factory/printer.cpp
index 928fc4f..31f7116 100644
--- a/src/factory/printer.cpp
+++ b/src/factory/printer.cpp
@@ -404,6 +404,9 @@ std::ostream& operator<<(std::ostream& strm, const PVStructure::Formatter& forma
     if(format.xfmt==PVStructure::Formatter::JSON) {
         JSONPrintOptions opts;
         opts.multiLine = false;
+ opts.json5 = true;
         printJSON(strm, format.xtop, format.xshow ? *format.xshow : BitSet().set(0), opts);
         return strm;

Given that this is actually a bug against pvDataCPP I have filed an issue against that module on GitHub referring to this bug report: