Tabnine Logo
FromJson.fromJsonNode
Code IndexAdd Tabnine to your IDE (free)

How to use
fromJsonNode
method
in
com.moz.fiji.schema.util.FromJson

Best Java code snippets using com.moz.fiji.schema.util.FromJson.fromJsonNode (Showing top 3 results out of 315)

origin: com.moz.fiji.schema/fiji-schema

final Schema optionalType = AvroUtils.getOptionalType(schema);
if (optionalType != null) {
 return json.isNull() ? null : fromJsonNode(json, optionalType);
  return fromJsonNode(actualNode, type);
 return fromJsonNode(json, type);
} catch (IOException ioe) {
origin: com.moz.fiji.schema/fiji-schema

/**
 * Decodes a JSON encoded record.
 *
 * @param json JSON tree to decode, encoded as a string.
 * @param schema Avro schema of the value to decode.
 * @return the decoded value.
 * @throws IOException on error.
 */
public static Object fromJsonString(String json, Schema schema) throws IOException {
 final ObjectMapper mapper = new ObjectMapper();
 final JsonParser parser = new JsonFactory().createJsonParser(json)
   .enable(Feature.ALLOW_COMMENTS)
   .enable(Feature.ALLOW_SINGLE_QUOTES)
   .enable(Feature.ALLOW_UNQUOTED_FIELD_NAMES);
 final JsonNode root = mapper.readTree(parser);
 return fromJsonNode(root, schema);
}
origin: com.moz.fiji.schema/fiji-schema

while (it.hasNext()) {
 final JsonNode element = it.next();
 list.add(fromJsonNode(element, schema.getElementType()));
while (it.hasNext()) {
 final Map.Entry<String, JsonNode> entry = it.next();
 map.put(entry.getKey(), fromJsonNode(entry.getValue(), schema.getValueType()));
 final JsonNode fieldElement = json.get(fieldName);
 if (fieldElement != null) {
  final Object fieldValue = fromJsonNode(fieldElement, field.schema());
  record.put(field.pos(), fieldValue);
 } else if (field.defaultValue() != null) {
  record.put(field.pos(), fromJsonNode(field.defaultValue(), field.schema()));
 } else {
  throw new IOException(String.format(
com.moz.fiji.schema.utilFromJsonfromJsonNode

Javadoc

Decodes a JSON node as an Avro value. Comply with specified default values when decoding records with missing fields.

Popular methods of FromJson

  • fromJsonString
    Decodes a JSON encoded record.
  • enumValue
    Looks up an Avro enum by name and string value.
  • fromAvroJsonString
    Standard Avro JSON decoder.
  • fromUnionJsonNode
    Decodes a union from a JSON node.
  • newSpecificRecord
    Instantiates a specific record by name.

Popular in Java

  • Updating database using SQL prepared statement
  • getExternalFilesDir (Context)
  • runOnUiThread (Activity)
  • getContentResolver (Context)
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now