brudaswen / kotlinx-serialization-csv Goto Github PK
View Code? Open in Web Editor NEWLibrary to easily use Kotlin Serialization to serialize to/from CSV.
License: Apache License 2.0
Library to easily use Kotlin Serialization to serialize to/from CSV.
License: Apache License 2.0
KotlinX Serialization has released 1.0.0-RC last month
Is there a way to customize headers? Don't like saying this but perhaps with a custom annotation? :)
Given a value class, and some data class to represent the CSV contents:
@JvmInline
@Serializable
value class MyId(val value: String)
@Serializable
data class Entry(
@SerialName("my_id") val id: MyId,
@SerialName("my_content") val content: String,
)
this will correctly decode the following CSV
my_id, my_content
A, A Test
B, B Test
but when serializing a list of Entry
objects, the column name for Entry.id
includes the value
property from the MyId
class.
my_id.value, my_content
A, A Test
B, B Test
The value/inline class's property should be serialized directly without the hierarchical property name.
It would be great to support Kotlin Multiplatform, so it would be possible to use not only on JVM
I checked, it already works on multiplatform module just fine, so the only missing part is publishing for MPP
Is there currently a way to ignore unknown column headers similar to how the Json serializer has a ignoreUnknownKeys
option?
Unfortunately 0.14.0 is no longer compatible with more recent versions of Kotlin. I took a quick stab at porting the code, besides API changes it seems like there were some behavioural changes as well - have you taken a look yet?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.