Skip to content

Commit 196d06c

Browse files
authored
Fixed some typos in the built-in classes chapter. (#1216)
1 parent 548550f commit 196d06c

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

docs/builtin-classes.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
This is the second chapter of the [Kotlin Serialization Guide](serialization-guide.md).
66
In addition to all the primitive types and strings, serialization for some classes from the Kotlin standard library,
7-
including the standard collections, is built into the Kotlin Serialization. This chapter explains the details.
7+
including the standard collections, is built into Kotlin Serialization. This chapter explains the details.
88

99
**Table of contents**
1010

@@ -33,9 +33,9 @@ import kotlinx.serialization.json.*
3333

3434
## Primitives
3535

36-
Kotlin serialization has the following ten primitives:
36+
Kotlin Serialization has the following ten primitives:
3737
`Boolean`, `Byte`, `Short`, `Int`, `Long`, `Float`, `Double`, `Char`, `String`, and enums.
38-
The other types in Kotlin serialization are _composite_ — composed of those primitive values.
38+
The other types in Kotlin Serialization are _composite_—composed of those primitive values.
3939

4040
### Numbers
4141

@@ -68,7 +68,7 @@ Their natural representation in JSON is used.
6868

6969
<!--- TEST -->
7070

71-
> Experimental unsigned numbers as well as other experimental inline classes are not supported by Kotlin serialization yet.
71+
> Experimental unsigned numbers as well as other experimental inline classes are not supported by Kotlin Serialization yet.
7272
7373

7474
### Long numbers
@@ -87,7 +87,7 @@ fun main() {
8787

8888
> You can get the full code [here](../guide/example/example-builtin-02.kt).
8989
90-
By default, they are serialized to JSON as numbers.
90+
By default they are serialized to JSON as numbers.
9191

9292
```text
9393
{"signature":2067120338512882656}
@@ -97,17 +97,17 @@ By default, they are serialized to JSON as numbers.
9797

9898
### Long numbers as strings
9999

100-
The JSON output from the previous example will get decoded normally by Kotlin serialization running on Kotlin/JS.
100+
The JSON output from the previous example will get decoded normally by Kotlin Serialization running on Kotlin/JS.
101101
However, if we try to parse this JSON by native JavaScript methods, we get this truncated result.
102102

103103
```
104104
JSON.parse("{\"signature\":2067120338512882656}")
105105
▶ {signature: 2067120338512882700}
106106
```
107107

108-
The full range of Kotlin Long does not fit in the JavaScript number, so its precision gets lost in JavaScript.
109-
A common workaround is to represent long numbers with full precision using JSON string type.
110-
This approach is optionally supported by Kotlin serialization with [LongAsStringSerializer] that
108+
The full range of a Kotlin Long does not fit in the JavaScript number, so its precision gets lost in JavaScript.
109+
A common workaround is to represent long numbers with full precision using the JSON string type.
110+
This approach is optionally supported by Kotlin Serialization with [LongAsStringSerializer], which
111111
can be specified for a given Long property using the [`@Serializable`][Serializable] annotation:
112112

113113
<!--- INCLUDE
@@ -160,7 +160,7 @@ fun main() {
160160

161161
> You can get the full code [here](../guide/example/example-builtin-04.kt).
162162
163-
In JSON enum gets encoded as a string.
163+
In JSON an enum gets encoded as a string.
164164

165165
```text
166166
{"name":"kotlinx.serialization","status":"SUPPORTED"}
@@ -170,7 +170,7 @@ In JSON enum gets encoded as a string.
170170

171171
### Serial names of enum entries
172172

173-
Serial names of enum entries can be customized with [SerialName] annotation just like
173+
Serial names of enum entries can be customized with the [SerialName] annotation just like
174174
it was shown for properties in the [Serial field names](basic-serialization.md#serial-field-names) section.
175175
However, in this case, the whole enum class must be marked with the [`@Serializable`][Serializable] annotation.
176176

@@ -199,11 +199,11 @@ We see that the specified serial name is now used in the resulting JSON.
199199

200200
## Composites
201201

202-
A number of composite types from the standard library are supported by Kotlin serialization.
202+
A number of composite types from the standard library are supported by Kotlin Serialization.
203203

204204
### Pair and triple
205205

206-
Simple data classes [Pair] and [Triple] from the Kotlin standard library are serializable.
206+
The simple data classes [Pair] and [Triple] from the Kotlin standard library are serializable.
207207

208208
```kotlin
209209
@Serializable
@@ -223,7 +223,7 @@ fun main() {
223223

224224
<!--- TEST -->
225225

226-
> Not all classes from the Kotlin standard library are serializable. In particular, ranges and [Regex] class
226+
> Not all classes from the Kotlin standard library are serializable. In particular, ranges and the [Regex] class
227227
> are not serializable at the moment. Support for their serialization may be added in the future.
228228
229229
### Lists
@@ -255,7 +255,7 @@ The result is represented as a list in JSON.
255255

256256
### Sets and other collections
257257

258-
Other collections, like a [Set], are also serializable.
258+
Other collections, like [Set], are also serializable.
259259

260260
```kotlin
261261
@Serializable
@@ -272,7 +272,7 @@ fun main() {
272272

273273
> You can get the full code [here](../guide/example/example-builtin-08.kt).
274274
275-
The [Set] is also represented as a list in JSON, like all other collections.
275+
[Set] is also represented as a list in JSON, like all other collections.
276276

277277
```text
278278
[{"name":"kotlinx.serialization"},{"name":"kotlinx.coroutines"}]
@@ -283,7 +283,7 @@ The [Set] is also represented as a list in JSON, like all other collections.
283283
### Deserializing collections
284284

285285
During deserialization, the type of the resulting object is determined by the static type that was specified
286-
in the source code &mdash; either as the type of the property or as the type parameter of the decoding function.
286+
in the source code&mdash;either as the type of the property or as the type parameter of the decoding function.
287287
The following example shows how the same JSON list of integers is deserialized into two properties of
288288
different Kotlin types.
289289

@@ -307,7 +307,7 @@ fun main() {
307307

308308
> You can get the full code [here](../guide/example/example-builtin-09.kt).
309309
310-
Because `data.b` property is a [Set], the duplicate values from it had disappeared.
310+
Because the `data.b` property is a [Set], the duplicate values from it disappeared.
311311

312312
```text
313313
Data(a=[42, 42], b=[42])
@@ -317,7 +317,7 @@ Data(a=[42, 42], b=[42])
317317

318318
### Maps
319319

320-
A [Map] with a primitive or enum keys and an arbitrary serializable values can be serialized.
320+
A [Map] with primitive or enum keys and arbitrary serializable values can be serialized.
321321

322322
```kotlin
323323
@Serializable
@@ -344,16 +344,16 @@ even if they are numbers in Kotlin, as we can see below.
344344
<!--- TEST -->
345345

346346
> It is a JSON-specific limitation that keys cannot be composite.
347-
> It can be lifted as shown in [Allowing structured map keys](json.md#allowing-structured-map-keys) section.
347+
> It can be lifted as shown in the [Allowing structured map keys](json.md#allowing-structured-map-keys) section.
348348
349349

350350
### Unit and singleton objects
351351

352-
Kotlin builtin `Unit` type is also serializable.
353-
`Unit` is a Kotlin [singleton object](https://kotlinlang.org/docs/tutorials/kotlin-for-py/objects-and-companion-objects.html)
352+
The Kotlin builtin `Unit` type is also serializable.
353+
`Unit` is a Kotlin [singleton object](https://kotlinlang.org/docs/tutorials/kotlin-for-py/objects-and-companion-objects.html),
354354
and is handled equally with other Kotlin objects.
355355

356-
Conceptually, singleton is a class with the only instance, meaning that state does not define the object,
356+
Conceptually, a singleton is a class with only one instance, meaning that state does not define the object,
357357
but the object defines its state. In JSON, objects are serialized as empty structures.
358358

359359
```kotlin
@@ -370,8 +370,8 @@ fun main() {
370370

371371
> You can get the full code [here](../guide/example/example-builtin-11.kt).
372372
373-
While it may seem useless at the first glance, this comes handy for sealed class serialization,
374-
which is explained in [Polymorphism. Objects](polymorphism.md#objects) section.
373+
While it may seem useless at first glance, this comes in handy for sealed class serialization,
374+
which is explained in the [Polymorphism. Objects](polymorphism.md#objects) section.
375375

376376
```text
377377
{}

0 commit comments

Comments
 (0)