Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
net.mamoe.yamlkt:yamlkt-tvosx64
Advanced tools
Multiplatform YAML parser & serializer for kotlinx.serialization written in pure Kotlin.
Fast multi-platform YAML with comments support for kotlinx.serialization
This project is in alpha state.
Third-party formats for kotlinx.serialization is strongly dependent on the versions of kotlinx-serialization-core
and Kotlin compiler.
The table below shows recommended version parings.
Note that normally you may use higher versions within the minor version range, e.g. preferring 1.3.3
or 1.3.0
over 1.3.2
.
yamlkt | Kotlin | kotlinx-serialization-core |
---|---|---|
0.3.3 | 1.3.70 | 0.20.0 |
0.5.3 | 1.4.0 | 1.0.0-RC |
0.6.0 | 1.4.10 | 1.0.0-RC2 |
0.8.0 | 1.4.10 | 1.0.1 |
0.9.0 | 1.4.30 | 1.1.0-RC |
0.10.2 | 1.5.20 | 1.2.1 |
0.10.2 | 1.5.31 | 1.3.0 |
0.11.0 | 1.6.21 | 1.3.3 |
0.12.0 | 1.6.21 | 1.3.3 |
0.12.0 | 1.7.10 | 1.3.3 |
repositories {
mavenCentral()
}
dependencies {
implementation("net.mamoe.yamlkt:yamlkt:0.12.0")
}
If your project is multiplatform, you need only to add this dependency for commonMain:
commonMain {
dependencies {
implementation("net.mamoe.yamlkt:yamlkt:0.12.0")
}
}
Only JVM target is available for Maven.
<dependency>
<groupId>net.mamoe.yamlkt</groupId>
<artifactId>yamlkt-jvm</artifactId>
<version>0.12.0</version>
</dependency>
This library supports:
@Contextual
, @Polymorphic
YamlDynamicSerializer
which works on Any
YamlElement
wrapper classes, allowing YamlMap.getInt
, YamlMap.getLong
Comment
)The features that aren't yet supported:
*
, &
)!!map
)|
and >
are partially supported; \
is not)This approach is fastest and recommended way as the type is already provided.
@Serializable
data class Test(
val test: String,
val optional: String = "optional", // Having default value means optional
val nest: Nested,
val list: List<String>
) {
@Serializable
data class Nested(
val numberCast: Int
)
}
println(Yaml.parse(Test.serializer(), """
test: testString
nest:
numberCast: 0xFE
list: [str, "str2"]
"""))
YamlKt provides a contextual serializer YamlDynamicSerializer
for Any
and YamlNullDynamicSerializer
for Any?
By default, YamlDynamicSerializer
is installed to Any
.
You can start by using @Contextual
:
@Serializable
data class Test(
val any: @Contextual Any
)
Yaml.parse(Test.serializer(), yamlText)
For input YAML text:
test: { key1: v1, key2: [v2, v3, v4] }
Alternatively, you can deserialize without any class:
val map: Map<String?, Any?> = Yaml.parseMap("""test: { key1: v1, key2: [v2, v3, v4] }""")
YamlElement
YamlElement
is a type-safe way to deserialize without descriptors.
val map: YamlMap = Yaml.decodeYamlMapFromString("""test: { key1: v1, key2: [v2, v3, v4] }""")
Annotate your comments to a field(property) using @Comment
:
Example:
@Serializable
data class User(
@Comment("The name of the user")
val name: String = "value"
)
gives yaml text:
# The name of the user
name: ""
FAQs
Multiplatform YAML parser & serializer for kotlinx.serialization written in pure Kotlin.
We found that net.mamoe.yamlkt:yamlkt-tvosx64 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.