Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinniefalco/9d885a386623214a903dbaf030c7c14a to your computer and use it in GitHub Desktop.
Save vinniefalco/9d885a386623214a903dbaf030c7c14a to your computer and use it in GitHub Desktop.
{
//[snippet_init_list_7
value jv1 = { { "mercury", 36 }, { "venus", 67 }, { "earth", 93 } };
assert( jv1.is_object() );
assert( to_string(jv1) == "{\"mercury\":36,\"venus\":67,\"earth\":93}" );
array ja = { { "mercury", 36 }, { "venus", 67 }, { "earth", 93 } };
for (value& jv2 : ja)
assert( jv2.is_array() );
assert( to_string(ja) == "[[\"mercury\",36],[\"venus\",67],[\"earth\",93]]" );
//]
(void)jv1, ja;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment