Class JsonDeserializer

java.lang.Object
org.wikidata.wdtk.datamodel.helpers.JsonDeserializer

public class JsonDeserializer extends Object
Helper to deserialize datamodel objects from their JSON representation. We accept empty arrays as empty maps since there has been a confusion in the past between the two: https://phabricator.wikimedia.org/T138104
Author:
Antonin Delpeuch
  • Constructor Details

    • JsonDeserializer

      public JsonDeserializer(String siteIri)
      Constructs a new JSON deserializer for the designated site.
      Parameters:
      siteIri - Root IRI of the site to deserialize for
  • Method Details

    • deserializeItemDocument

      public ItemDocument deserializeItemDocument(String json) throws com.fasterxml.jackson.core.JsonProcessingException
      Deserializes a JSON string into an ItemDocument.
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - if the JSON payload is invalid
    • deserializePropertyDocument

      public PropertyDocument deserializePropertyDocument(String json) throws com.fasterxml.jackson.core.JsonProcessingException
      Deserializes a JSON string into a PropertyDocument.
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - if the JSON payload is invalid
    • deserializeLexemeDocument

      public LexemeDocument deserializeLexemeDocument(String json) throws com.fasterxml.jackson.core.JsonProcessingException
      Deserializes a JSON string into a LexemeDocument.
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - if the JSON payload is invalid
    • deserializeMediaInfoDocument

      public MediaInfoDocument deserializeMediaInfoDocument(String json) throws com.fasterxml.jackson.core.JsonProcessingException
      Deserializes a JSON string into a MediaInfoDocument.
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - if the JSON payload is invalid
    • deserializeEntityDocument

      public EntityDocument deserializeEntityDocument(String json) throws com.fasterxml.jackson.core.JsonProcessingException
      Deserializes a JSON string into a EntityDocument.
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - if the JSON payload is invalid
    • deserializeEntityRedirectDocument

      public EntityRedirectDocument deserializeEntityRedirectDocument(String json) throws com.fasterxml.jackson.core.JsonProcessingException
      Deserializes a JSON string into a EntityRedirectDocument.
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - if the JSON payload is invalid