pvget json error
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
EPICS Base | Status tracked in 7.0 | |||||
7.0 |
Fix Committed
|
Medium
|
Unassigned |
Bug Description
I’ve been using `pvget -M json` and have noticed a problem with it when the PV has the alarm fields set like so:
double lowAlarmLimit nan
double lowWarningLimit nan
double highWarningLimit nan
double highAlarmLimit nan
When I run pvget I get the following:
> pvget -M json IOC:m1.RBV
IOC:m1.RBV {"value"
It looks like YAJL doesn’t like the nan values. If I set them to non-nan values then the error goes away.
This is with base 7.0.7.
The version of yajl that comes with Base 7.0.6.1 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 printer. cpp printer. cpp <(std:: ostream& strm, const PVStructure: :Formatter& forma format. xfmt==PVStructu re::Formatter: :JSON) {
JSONPrintOpti ons opts;
opts. multiLine = false; INT>=VERSION_ INT(7,0, 6,1)
printJSON( strm, format.xtop, format.xshow ? *format.xshow : BitSet().set(0), opts);
strm< <'\n';
index 928fc4f..31f7116 100644
--- a/src/factory/
+++ b/src/factory/
@@ -404,6 +404,9 @@ std::ostream& operator<
if(
+#if EPICS_VERSION_
+ opts.json5 = true;
+#endif
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: https:/ /github. com/epics- base/pvDataCPP/ issues/ 92