2020-04-10 13:06:54 +02:00
|
|
|
/* Copyright (C) 2016 by Rainer Gerhards
|
2016-11-27 11:50:48 +01:00
|
|
|
* Released under ASL 2.0 */
|
|
|
|
|
#include "config.h"
|
2019-09-08 21:34:13 -04:00
|
|
|
#include "json_object.h"
|
|
|
|
|
#include "json_tokener.h"
|
2020-03-28 10:25:00 +08:00
|
|
|
#include <stdio.h>
|
2016-11-27 11:50:48 +01:00
|
|
|
int main(void)
|
|
|
|
|
{
|
2020-03-28 10:25:00 +08:00
|
|
|
json_object *json;
|
2016-11-27 11:50:48 +01:00
|
|
|
|
2020-03-28 10:25:00 +08:00
|
|
|
json = json_object_new_double(1.0);
|
|
|
|
|
printf("json = %s\n", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY));
|
|
|
|
|
json_object_put(json);
|
2019-11-10 00:10:28 -05:00
|
|
|
|
2020-03-28 10:25:00 +08:00
|
|
|
json = json_object_new_double(-1.0);
|
|
|
|
|
printf("json = %s\n", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY));
|
|
|
|
|
json_object_put(json);
|
|
|
|
|
json = json_object_new_double(1.23);
|
|
|
|
|
printf("json = %s\n", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY));
|
|
|
|
|
json_object_put(json);
|
|
|
|
|
json = json_object_new_double(123456789.0);
|
|
|
|
|
printf("json = %s\n", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY));
|
|
|
|
|
json_object_put(json);
|
|
|
|
|
json = json_object_new_double(123456789.123);
|
|
|
|
|
printf("json = %s\n", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY));
|
|
|
|
|
json_object_put(json);
|
|
|
|
|
return 0;
|
2016-11-27 11:50:48 +01:00
|
|
|
}
|