Skip to content

Commit d75d283

Browse files
committed
add section abt jsonchecker
1 parent acd9b5d commit d75d283

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

tutorials/migrate-v4.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,26 @@
6262
* `bool Value::is<T>()` removed
6363
* `#include <matjson/stl_serialize.hpp>` -> `#include <matjson/std.hpp>`
6464
* Added new experimental `<matjson/reflect.hpp>` header, uses [qlibs/reflect](https://github.com/qlibs/reflect) to (de)serialize aggregate structs
65-
* Behavior might change in the future, so use with caution
65+
* Behavior might change in the future, so use with caution
66+
67+
## Changes to `JsonChecker` / `JsonExpectedValue`
68+
* The JsonChecker class was previously marked deprecated, and is now removed. Now you should move to using `JsonExpectedValue` instead
69+
```cpp
70+
auto checker = JsonChecker(json);
71+
auto root = checker.root("[file.json]").obj();
72+
73+
// ... code
74+
75+
if (checker.isError()) {
76+
return Err(checker.getError());
77+
}
78+
```
79+
is now
80+
```cpp
81+
auto root = checkJson(json, "[file.json]")
82+
83+
// ... code
84+
85+
GEODE_UNWRAP(root.ok());
86+
```
87+
* `JsonChecker::has` has different behavior to `JsonExpectedValue::has`, use `JsonExpectedValue::hasNullable` to keep old behavior with null values

0 commit comments

Comments
 (0)