Interface Json

All Known Implementing Classes:
GsonJson

public interface Json
JSON marshalling and unmarshalling service that is used by ODO both internally and can be used by client applications
  • Method Summary

    Modifier and Type Method Description
    String marshal​(Object instance)
    Marshals an instance of an object to a String
    <T> T unmarshal​(String json, Class<T> target)
    Converts a json string into an instance of the given target type
    default Map<String,​Object> unmarshalToMap​(String json)
    convenience method to convert json to a Map instance
  • Method Details

    • marshal

      String marshal​(Object instance)
      Marshals an instance of an object to a String
      Parameters:
      instance - to marshal to string, will throw NullPointerException if the parameter is null
      Returns:
      and instance of the instance parameter in a JSON string
    • unmarshal

      <T> T unmarshal​(String json, Class<T> target)
      Converts a json string into an instance of the given target type
      Type Parameters:
      T - the return type of the class
      Parameters:
      json - String of JSON to convert
      target - type of the target to convert the json to
      Returns:
      an instance of the converted json string
    • unmarshalToMap

      default Map<String,​Object> unmarshalToMap​(String json)
      convenience method to convert json to a Map instance
      Parameters:
      json - the json to convert to a Map
      Returns:
      the unmarshalled json in a Map