json: output NaN as null for '!num' modifiers

Change-Id: Ib70c21b4540416d07b539a3daba608a2c6f539d7