You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
country.cities[0].printInfo(); // prints: Basel was founded in -200 and is really beautiful!
225
225
} catch (e) {
226
226
console.log((<Error>e));
@@ -326,7 +326,7 @@ See the examples at the end of this document for more info about nesting arrays.
326
326
327
327
##### Adding a custom converter
328
328
329
-
More advanced users may need to use custom converters. If you don't want
329
+
More advanced users may need to use custom converters. If you want
330
330
`json2typescript` to use your custom converter, you need to follow these
331
331
steps:
332
332
@@ -358,6 +358,10 @@ The type is still checked as soon the property is present again.
358
358
359
359
The same applies for the case when you try to serialize a TypeScript object to a JSON object. If the property is not defined in the class and optional, it will not be added to the JSON object.
360
360
361
+
> Tip: Some API's return null instead of omitting optional values.
362
+
If you flag a property as optional, `json2typescript` will ignore null values and keep the default value of the property instead.
363
+
This fact is particularly helpful if your project uses TypeScript `strictNullChecks` or/and disallows `null` values through the `valueCheckingMode` property in `json2typescript`.
364
+
361
365
#### Important notes
362
366
363
367
* Make sure you define the expected type as accurate as possible, even if you expect primitive types.
@@ -454,7 +458,9 @@ The default is `ValueCheckingMode.ALLOW_OBJECT_NULL`.
0 commit comments