Skip to content

Commit

Permalink
Also add a decoding example.
Browse files Browse the repository at this point in the history
  • Loading branch information
pdvrieze committed Dec 12, 2023
1 parent 08d88af commit 5a22352
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ data class HelloWorld(val user: String)

println(XML.encodeToString(HelloWorld("You!")))
```

To deserialize you would do:
```kotlin
@Serializable
data class HelloWorld(val user: String)

XML.decodeFromString(HelloWorld.serializer(), "<HelloWorld user='You!' />")
```

Please look at the examples and the documentation for further features
that can influence: the tag names/namespaces used, the actual structure
used (how lists and polymorphic types are handled), etc.
Expand Down

0 comments on commit 5a22352

Please sign in to comment.