How to simplify Apache Avro?

I am developing an Android project with Apache Avro, but it depends on two Jackson libs (core-asl.jar and mapper-asl.jar). Unfortunately, these two libraries are too large for the Android app. I wonder if there is a way to simplify the Avro source code, or can I replace Jackson with org.json directly?

+7
android dependencies avro
source share
1 answer

If your schema is in JSON . We can use a different library to convert Json formatting. I used the GSON library to parse json data

Avro uses the JSON format to declare data structures.

Avro schemas are defined using JSON, which simplifies its implementation in languages ​​with JSON libraries.

So you can try this library built into jackson

app gradle dependency

compile 'com.google.code.gson:gson:2.7' 

Convert strings to object

  Gson gson = new Gson(); GsonParse gsonObj = gson.fromJson(jsonString); 

Convert objects to strings

 Gson gson = new Gson(); String puchaseDetails = gson.toJson(purchase); 

You can also check it here if you use a library to parse and store data.

-one
source share

All Articles