JsonNode is a base class that ObjectNode and ArrayNode extend. JsonNode represents any valid Json structure whereas ObjectNode and ArrayNode are particular implementations for objects (aka maps) and arrays, respectively.

ArrayNode has specific methods for dealing with arrays such as get(index i) E.g. you cannot get an item at a specific index in a JsonNode or ObjectNode but you can in an ArrayNode.

Answer from bhspencer on Stack Overflow
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › org › w3c › dom › Node.html
Node (Java Platform SE 8 )
July 21, 2026 - 8 ... Attr, CDATASection, ... SOAPFault, SOAPFaultElement, SOAPHeader, SOAPHeaderElement, Text, Text ... The Node interface is the primary datatype for the entire Document Object Model....
🌐
Oracle
docs.oracle.com › cd › E18150_01 › javadocs › SunMasterIndex › com › sun › mdm › index › objects › ObjectNode.html
ObjectNode (Master Index)
ObjectNode The parent object node of the given object. ... Retrieves the value of a field given the field's name. ... Object The value of the given field. ... ObjectException - Thrown if an error occurs while retrieving the field value. public ObjectField getValueObject(java.lang.String name) ...
🌐
Baeldung
baeldung.com › home › json › jackson › working with tree model nodes in jackson
Working with Tree Model Nodes in Jackson | Baeldung
January 8, 2024 - Next, we have three different ways to create a tree node once we have our ObjectMapper. This is the most common way to create a node out of nothing: ... This method is well covered in the Jackson – Marshall String to JsonNode article. Please refer to it for more info. A node may be converted from a Java object by calling the valueToTree(Object fromValue) method on the ObjectMapper:
🌐
University of Colorado Boulder
home.cs.colorado.edu › ~main › docs › edu › colorado › nodes › ObjectNode.html
ObjectNode
A ObjectNode provides a node for a linked list with Object data in each node. ... Java Source Code for this class (www.cs.colorado.edu/~main/edu/colorado/nodes/ObjectNode.java) , Node, BooleanNode, CharNode, DoubleNode, FloatNode, IntNode, LongNode, ShortNode
🌐
Javadoc.io
javadoc.io › doc › com.fasterxml.jackson.core › jackson-databind › latest › com › fasterxml › jackson › databind › node › ObjectNode.html
ObjectNode - jackson-databind 2.22.1 javadoc
Bookmarks · Latest version of com.fasterxml.jackson.core:jackson-databind · https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind · Current version 2.22.1 · https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind/2.22.1 · package-list path (used for javadoc generation ...
Find elsewhere
🌐
University of Colorado Boulder
home.cs.colorado.edu › ~main › docs › edu › colorado › nodes › Node.html
Node
edu.colorado.nodes · java.lang.Object · edu.colorado.nodes.Node<E> public class Node<E> extends java.lang.Object · A Node provides a generic node for a linked list. Each node contains a piece of data (which is a reference to an E object) and a link (which is a reference to the next node ...
🌐
Medium
cowtowncoder.medium.com › jackson-tips-objectnode-putpojo-putrawvalue-for-fun-and-profit-358f8f3b8580
Jackson Tips: ObjectNode.putPOJO(), putRawValue() for fun ...
September 29, 2021 - ObjectNode obToWrite = mapper.createObjectNode(); obToWrite.put("id", 123); obToWrite.put("name", "Bob"); // and so on... and then serialize OutputStream out = ...; mapper.writeValue(out, obToWrite); So far there is nothing particularly new here. But a lesser known approach is to use value types OTHER than JsonNode with node types, to combine different kinds of Java values with Tree Model.
Top answer
1 of 1
11

Welcome to Java! This Nodes are like a blocks, they must be assembled to do amazing things! In this particular case, your nodes can represent a list, a linked list, You can see an example here:

public class ItemLinkedList {
    private ItemInfoNode head;
    private ItemInfoNode tail;
    private int size = 0;

    public int getSize() {
        return size;
    }

    public void addBack(ItemInfo info) {
        size++;
        if (head == null) {
            head = new ItemInfoNode(info, null, null);
            tail = head;
        } else {
            ItemInfoNode node = new ItemInfoNode(info, null, tail);
            this.tail.next =node;
            this.tail = node;
        }
    }

    public void addFront(ItemInfo info) {
        size++;
        if (head == null) {
            head = new ItemInfoNode(info, null, null);
            tail = head;
        } else {
            ItemInfoNode node = new ItemInfoNode(info, head, null);
            this.head.prev = node;
            this.head = node;
        }
    }

    public ItemInfo removeBack() {
        ItemInfo result = null;
        if (head != null) {
            size--;
            result = tail.info;
            if (tail.prev != null) {
                tail.prev.next = null;
                tail = tail.prev;
            } else {
                head = null;
                tail = null;
            }
        }
        return result;
    }

    public ItemInfo removeFront() {
        ItemInfo result = null;
        if (head != null) {
            size--;
            result = head.info;
            if (head.next != null) {
                head.next.prev = null;
                head = head.next;
            } else {
                head = null;
                tail = null;
            }
        }
        return result;
    }

    public class ItemInfoNode {

        private ItemInfoNode next;
        private ItemInfoNode prev;
        private ItemInfo info;

        public ItemInfoNode(ItemInfo info, ItemInfoNode next, ItemInfoNode prev) {
            this.info = info;
            this.next = next;
            this.prev = prev;
        }

        public void setInfo(ItemInfo info) {
            this.info = info;
        }

        public void setNext(ItemInfoNode node) {
            next = node;
        }

        public void setPrev(ItemInfoNode node) {
            prev = node;
        }

        public ItemInfo getInfo() {
            return info;
        }

        public ItemInfoNode getNext() {
            return next;
        }

        public ItemInfoNode getPrev() {
            return prev;
        }
    }
}

EDIT:

Declare ItemInfo as this:

public class ItemInfo {
    private String name;
    private String rfdNumber;
    private double price;
    private String originalPosition;

    public ItemInfo(){
    }

    public ItemInfo(String name, String rfdNumber, double price, String originalPosition) {
        this.name = name;
        this.rfdNumber = rfdNumber;
        this.price = price;
        this.originalPosition = originalPosition;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRfdNumber() {
        return rfdNumber;
    }

    public void setRfdNumber(String rfdNumber) {
        this.rfdNumber = rfdNumber;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getOriginalPosition() {
        return originalPosition;
    }

    public void setOriginalPosition(String originalPosition) {
        this.originalPosition = originalPosition;
    }
}

Then, You can use your nodes inside the linked list like this:

public static void main(String[] args) {
    ItemLinkedList list = new ItemLinkedList();
    for (int i = 1; i <= 10; i++) {
        list.addBack(new ItemInfo("name-"+i, "rfd"+i, i, String.valueOf(i)));

    }
    while (list.size() > 0){
        System.out.println(list.removeFront().getName());
    }
}
🌐
Java Code Geeks
examples.javacodegeeks.com › home › java development › core java
Java Node Example - Java Code Geeks
September 20, 2021 - An Individual Node in java is a class that is used to create the individual data holding blocks for various data structures, which organize data in a nonsequential fashion. A Node class can be customized to store one or more data fields and ...
🌐
University of Hawaii
www2.hawaii.edu › ~walbritt › ics211 › examples › Node.java
/ A generic Node class that Stores a reference to Data and the next Node
/** * A generic Node class that Stores a reference to Data and the next Node * * @author William McDaniel Albritton */ public class Node ... /** * Constructor - Used To Create EAch Object and Initialize DAta Fields. * * @param data2 initializes the data variable.
🌐
GitHub
github.com › codehaus › jackson › blob › master › src › mapper › java › org › codehaus › jackson › node › ObjectNode.java
jackson/src/mapper/java/org/codehaus/jackson/node/ObjectNode.java at master · codehaus/jackson
import java.util.*; · import org.codehaus.jackson.*; import org.codehaus.jackson.map.SerializerProvider; import org.codehaus.jackson.map.TypeSerializer; · /** * Node that maps to JSON Object structures in JSON content. */ public class ObjectNode · extends ContainerNode ·
Author: codehaus
🌐
Fasterxml
fasterxml.github.io › jackson-databind › javadoc › 2.5 › com › fasterxml › jackson › databind › node › ObjectNode.html
ObjectNode (jackson-databind 2.5.0 API)
Method for finding a JSON Object field with specified name in this node or its child nodes, and returning value it has. If no matching field is found in this node or its descendants, returns null. ... Method for finding a JSON Object that contains specified field, within this node or its ...
🌐
Oracle
docs.oracle.com › en › java › javase › 21 › docs › api › java.xml › org › w3c › dom › Node.html
Node (Java SE 21 & JDK 21)
January 20, 2026 - A NodeList that contains all children of this node. ... This method returns a specialized object which implements the specialized APIs of the specified feature and version, as specified in .
🌐
Fasterxml
fasterxml.github.io › jackson-databind › javadoc › 2.7 › com › fasterxml › jackson › databind › node › ObjectNode.html
ObjectNode (jackson-databind 2.7.0 API)
Method for finding a JSON Object field with specified name in this node or its child nodes, and returning value it has. If no matching field is found in this node or its descendants, returns null. ... Method for finding a JSON Object that contains specified field, within this node or its ...