Class JsonDeserializer
java.lang.Object
org.wikidata.wdtk.datamodel.helpers.JsonDeserializer
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 Summary
ConstructorsConstructorDescriptionJsonDeserializer(String siteIri) Constructs a new JSON deserializer for the designated site. -
Method Summary
Modifier and TypeMethodDescriptionDeserializes a JSON string into aEntityDocument.Deserializes a JSON string into aEntityRedirectDocument.Deserializes a JSON string into anItemDocument.Deserializes a JSON string into aLexemeDocument.Deserializes a JSON string into aMediaInfoDocument.Deserializes a JSON string into aPropertyDocument.
-
Constructor Details
-
JsonDeserializer
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 anItemDocument.- 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 aPropertyDocument.- 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 aLexemeDocument.- 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 aMediaInfoDocument.- 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 aEntityDocument.- 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 aEntityRedirectDocument.- Throws:
com.fasterxml.jackson.core.JsonProcessingException- if the JSON payload is invalid
-