Skip to content

Commit b5627b2

Browse files
committed
Fixed issue with json_options array_array_split_lines::new_line
1 parent d704093 commit b5627b2

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

doc/ref/corelib/basic_json_options.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -316,26 +316,28 @@ using namespace jsoncons;
316316

317317
int main()
318318
{
319-
json j;
320-
321-
j["verts"] = json(json_array_arg, {1, 2, 3});
322-
j["normals"] = json(json_array_arg, {1, 0, 1});
323-
j["uvs"] = json(json_array_arg, {0, 0, 1, 1});
319+
json j = json::parse(R"(
320+
{
321+
"normals": [1, 0, 1],
322+
"uvs": [0, 0, 1, 1],
323+
"verts": [1, 2, 3]
324+
}
325+
)");
324326

325327
std::cout << "multi_line: (default)" << '\n';
326328
auto options1 = json_options{}
327-
.object_array_line_splits(line_split_kind::multi_line);
329+
.object_array_line_splits(line_split_kind::multi_line);
328330
std::cout << pretty_print(j, options1) << "\n\n";
329331

332+
std::cout << "new_iine:" << '\n';
333+
auto options3 = json_options{}
334+
.object_array_line_splits(line_split_kind::new_line);
335+
std::cout << pretty_print(j, options3) << "\n\n";
336+
330337
std::cout << "same_line: " << '\n';
331338
auto options2 = json_options{}
332-
.object_array_line_splits(line_split_kind::same_line);
339+
.object_array_line_splits(line_split_kind::same_line);
333340
std::cout << pretty_print(j, options2) << "\n\n";
334-
335-
std::cout << "new_ine:" << '\n';
336-
auto options3 = json_options{}
337-
.object_array_line_splits(line_split_kind::new_line);
338-
std::cout << pretty_print(j, options3) << "\n\n";
339341
}
340342
```
341343

0 commit comments

Comments
 (0)