Skip to content

Commit 7bd15d3

Browse files
committed
chore: v0.3.0
1 parent 07473f4 commit 7bd15d3

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# v0.2.1
1+
# v0.3.0
22

33
## What's Changed
44

5-
- add other kotlin targets
6-
- use custom hexToDecimal instead of java BigInteger
5+
- optimize memory usage
6+
- add parse json5 token

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
kotlin multiplatform json5 for [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization)
44

5-
its principle is to convert a JSON5 string into a valid JsonElement object, which facilitates interoperability with kotlinx serialization
6-
75
## Usage
86

97
```kotlin
10-
implementation("li.songe:json5:0.2.0")
8+
implementation("li.songe:json5:0.3.0")
119
```
1210

1311
## Decode
@@ -38,6 +36,20 @@ data class A(val id:Int)
3836
val a = json.decodeFromJson5String<A>("{id:0, b:''}")
3937
```
4038

39+
### Decode Json5Token
40+
41+
Json5String -> Json5Token
42+
43+
```kotlin
44+
val (element, ranges) = Json5.parseToJson5ElementAndRanges("{a:1}")
45+
```
46+
47+
Loose Json5String -> Json5Token
48+
49+
```kotlin
50+
val ranges = Json5.parseToJson5LooseRanges("{a:1,]{")
51+
```
52+
4153
## Encode
4254

4355
JsonElement -> Json5String

json5/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ kotlin {
4747
mavenPublishing {
4848
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
4949
signAllPublications()
50-
coordinates("li.songe", "json5", "0.2.1")
50+
coordinates("li.songe", "json5", "0.3.0")
5151

5252
val repoUrl = "https://github.com/lisonge/kotlin-json5"
5353
pom {

0 commit comments

Comments
 (0)