Updates serialization example and readme.md

pull/35/head
Krzysztof Gabis 9 years ago
parent 6905548257
commit f4cfcd7699
  1. 4
      README.md
  2. 2
      tests.c

@ -111,7 +111,7 @@ void serialization_example(void) {
json_object_set_number(root_object, "age", 25); json_object_set_number(root_object, "age", 25);
json_object_dotset_string(root_object, "address.city", "Cupertino"); json_object_dotset_string(root_object, "address.city", "Cupertino");
json_object_dotset_value(root_object, "contact.emails", json_parse_string("[\"email@example.com\",\"email2@example.com\"]")); json_object_dotset_value(root_object, "contact.emails", json_parse_string("[\"email@example.com\",\"email2@example.com\"]"));
serialized_string = json_serialize_to_string(root_value); serialized_string = json_serialize_to_string_pretty(root_value);
puts(serialized_string); puts(serialized_string);
json_free_serialized_string(serialized_string); json_free_serialized_string(serialized_string);
json_value_free(root_value); json_value_free(root_value);
@ -119,7 +119,7 @@ void serialization_example(void) {
``` ```
Created value (after formatting outside parson): Output:
``` ```
{ {
"name": "John Smith", "name": "John Smith",

@ -480,7 +480,7 @@ void serialization_example(void) {
json_object_dotset_string(root_object, "address.city", "Cupertino"); json_object_dotset_string(root_object, "address.city", "Cupertino");
json_object_dotset_value(root_object, "contact.emails", json_object_dotset_value(root_object, "contact.emails",
json_parse_string("[\"email@example.com\", \"email2@example.com\"]")); json_parse_string("[\"email@example.com\", \"email2@example.com\"]"));
serialized_string = json_serialize_to_string(root_value); serialized_string = json_serialize_to_string_pretty(root_value);
puts(serialized_string); puts(serialized_string);
json_free_serialized_string(serialized_string); json_free_serialized_string(serialized_string);
json_value_free(root_value); json_value_free(root_value);

Loading…
Cancel
Save