Skip to content

Azure Json Migration

Alan Zimmer edited this page Jan 24, 2024 · 8 revisions

Azure Json

com.azure:azure-json is a library that defines interfaces for reading and writing JSON using streaming APIs, or in other words, APIs where you explicitly define the behavior of the JSON being written. For example, a simple object with a single string property "hello":

jsonWriter.writeStartObject()
    .writeStringField("hello", "world")
    .writeEndObject();

com.azure:azure-json contains no external dependencies and provides a default implementation of the reader and writer interfaces.

Benefits

  1. azure-json contains no external dependencies, removing possible dependency conflicts with popular JSON serialization libraries such as Jackson and GSON.
  2. Stream serialization is easier to debug and reason about behavior as there isn't configurations hidden at construction time of the reader and writer nor does it need to perform reflective accesses to objects being deserialized.
  3. Reduces the amount of reflection and reflective access permissions, limiting possible access denied exceptions if the module system is configured incorrectly or a SecurityManager is being used to limit permissions during runtime.
  4. Possible reduction in JAR sizes and potential performance gains.
  5. Since reading and writing logic are interfaces the backing implementation could conform to the environment running the Azure SDK code. For example, you can use a GSON or Jackson implementation instead of the default.

Migration guide

Clone this wiki locally