enjektor0
enjektor0

Reputation: 543

Kotlin-Android serialize json without using third party library

is there any solution other than Moshi, Gson, KotlinX-Serialization to serialize json in Android? We should not add anything to build.gradle while using technology. We should not download a library from here.

Is there a method on Android just like Codable on iOS? Also, I think how we should do this part is important since Converter will be passed when using it with Retrofit.

Does anyone have experience and advice on this subject?

Upvotes: 1

Views: 1281

Answers (1)

Stephan
Stephan

Reputation: 16759

You can use JSONObject for that.

val json = JSONObject("""{"some":"json"}""")

However, easiest is to use one of the third party frameworks you mentioned to do this.

Upvotes: 1

Related Questions