Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenberry committed Jul 10, 2023
1 parent f323b8f commit 22e3606
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,21 @@ expect(s == R"({"pi":3.14,"happy":true,"name":"Stephen","arr":["Hello","World",2
> This approach is significantly faster than `glz::json_t` for generic JSON. But, may not be suitable for all contexts.
## Merge
`glz::merge` allows the user to merge multiple JSON object types into a single object.
```c++
glz::obj o{"pi", 3.141};
std::map<std::string_view, int> map = {{"a", 1}, {"b", 2}, {"c", 3}};
auto merged = glz::merge{o, map};
std::string s{};
glz::write_json(merged, s); // will write out a single, merged object
// s is now: {"pi":3.141,"a":0,"b":2,"c":3}
```

> `glz::merge` stores references to lvalues to avoid copies
## Generic JSON

See [Generic JSON](./docs/generic-json.md) for `glz::json_t`.
Expand Down

0 comments on commit 22e3606

Please sign in to comment.