ecorm / cppwamp

C++ client library for the WAMP protocol.
Boost Software License 1.0
35 stars 9 forks source link

Portable encoding of NaN and infinity to JSON #61

Closed ecorm closed 9 years ago

ecorm commented 9 years ago

wamp::Json::encode currently relies on std::snprintf to encode numbers to JSON. If NaN or +/-Infinity is passed to the encoder, it will be serialized as nan and inf/infinity, according to the fprintf documentation.

Unfortunately, JSON does not support encoding of these special values, as raised in this SO question.

wamp::Json::encode should therefore recognize these special values, and encode them as null.