Added a utility method for parsing double values from json

It handles NaN and infinity.