Fix json output when printing legend entries

Branch 1.4 is missing this patch in order to produce valid json output.
This is related to issue #380 reported by apfeiffe.
Fix json output when printing infinity values

The printf of a rrd_value_t variable can output inf in case of an
infinity value. That inf value is not JSON valid, nor are Infinity,
NaN, Number.NEGATIVE_INFINITY or Number.POSITIVE_INFINITY.

This commit adds a test for infinity values by using isinf() and
outputs a null in such case.
Merge pull request #427 from julthomas/jth/1.4/json

Fix json output when printing legend entries