1

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?

3
  • 1
    Well... all of those libs are open source you can always look at their source code. In Android there's the implementation of JSON objects in the org.json package which, if I am not mistaken, comes with the framework. You'd have to do the parsing yourself, just like with Codable on iOS. If you want samples, there are plenty of examples. Commented Feb 8, 2022 at 12:00
  • Why not use a third party? You aren't allowed to use any third party? You know RetroFit is a third party too right? Commented Feb 8, 2022 at 12:05
  • I'm building an android library and I don't want to use a third party library. I guess we won't be using retrofit either. Commented Feb 8, 2022 at 12:32

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.