Skip to content

Commit

Permalink
completed experimental dump() extension
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed May 8, 2016
1 parent 70a5655 commit 6d132fa
Show file tree
Hide file tree
Showing 7 changed files with 455 additions and 84 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ $ make
$ ./json_unit "*"

===============================================================================
All tests passed (5568705 assertions in 31 test cases)
All tests passed (5568724 assertions in 32 test cases)
```

For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml).
8 changes: 8 additions & 0 deletions doc/examples/dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,12 @@ int main()
std::cout << j_array.dump(-1) << "\n\n";
std::cout << j_array.dump(0) << "\n\n";
std::cout << j_array.dump(4) << "\n\n";

// user-defined printer: do not separate array values with newlines
json::printer my_printer = json::printer::pretty_printer();
my_printer.array_comma = ", ";

// call dump() with user-defined printer
std::cout << j_object.dump(4, my_printer) << "\n\n";
std::cout << j_array.dump(4, my_printer) << std::endl;
}
2 changes: 1 addition & 1 deletion doc/examples/dump.link
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/PjtHNsrmmgEeCFVp"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/o2gypyOpAA1Z4LKT"><b>online</b></a>
8 changes: 8 additions & 0 deletions doc/examples/dump.output
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@
16
]

{
"one": 1,
"two": 2
}

[
1, 2, 4, 8, 16
]
Loading

0 comments on commit 6d132fa

Please sign in to comment.