I've created jspoon in 2017. A lot has changed since then, but I've tried to make kspoon mostly compatible with jspoon. However, there are a few breaking changes.
jspoon was compatible with Java and Kotlin JVM. kspoon, on the other hand, is compatible with Kotlin Multiplatform only, so it won't work with code written in Java. Migration is possible for Kotlin JVM projects.
@Selector.attr = "innerhtml"
(or"html"
/"outerHtml"
) has been replaced with@Selector.textMode = SelectorHtmlTextMode.InnerHtml
(orSelectorHtmlTextMode.Text
/SelectorHtmlTextMode.OuterHtml
). This change fixes edge cases where selecting<tag html="value" />
wasn't parsed correctly (and using an enum provides a nicer API). See Selecting content.- The
@Format
annotation is not supported by kspoon. Instead,KSerializer<T>
can be used to specify the format for parsing. See Serializers. - Custom converters are not supported by kspoon.
KSerializers<T>
withKspoonDecoder
can be used instead. See Custom serializers. - Different parsing API: instead of
Jspoon.create()
,jspoon.adapter
, andhtmlAdapter.fromHtml
, useKspoon.parse
. See Usage. - Retrofit integration is different. See Retrofit integration.
- Replace jspoon dependency with kspoon and apply the serialization plugin. See Installation.
- Add
@Serializable
to each class that should be parsed. - Replace
import pl.droidsonroids.jspoon.annotation.Selector
withimport dev.burnoo.kspoon.annotation.Selector
. - Replace usages of
@Selector.attr = "innerhtml"
(or"html"
/"outerHtml"
) with@Selector.textMode = SelectorHtmlTextMode.InnerHtml
(orSelectorHtmlTextMode.OuterHtml
). See Selecting content. - Replace
@Format
with aKSerializer<T>
implementation. See Serializers. - Replace usages of
Jspoon.create()
,jspoon.adapter
, andhtmlAdapter.fromHtml
withKspoon.parse
. See Usage. - Update integration with Retrofit if used. See Retrofit integration.
- Replace custom converters with
KSerializer<T>
andKspoonDecoder
. See Custom serializers.