mirror of
https://github.com/nlohmann/json.git
synced 2024-08-21 20:42:29 +02:00
22 lines
412 B
C++
22 lines
412 B
C++
#include <json.hpp>
|
|
|
|
using namespace nlohmann;
|
|
|
|
int main()
|
|
{
|
|
// create values of different floating-point types
|
|
float f42 = 42.23;
|
|
float f_nan = 1.0f / 0.0f;
|
|
double f23 = 23.42;
|
|
|
|
// create JSON numbers
|
|
json j42(f42);
|
|
json j_nan(f_nan);
|
|
json j23(f23);
|
|
|
|
// serialize the JSON numbers
|
|
std::cout << j42 << '\n';
|
|
std::cout << j_nan << '\n';
|
|
std::cout << j23 << '\n';
|
|
}
|