Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

string to pojo java

import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;

public class TestJackson {

public static void main(String[] args) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        String testJson = "{
" + "  "user": {
" + "    "0": {
" + "      "firstName": "Monica",
" + "      "lastName": "Belluci"
" + "    },
" + "    "1": {
" + "      "firstName": "John",
" + "      "lastName": "Smith"
" + "    },
" + "    "2": {
" + "      "firstName": "Owen",
" + "      "lastName": "Hargreaves"
" + "    }
" + "  }
" + "}";
        User readValue = mapper.readValue(testJson, User.class);
        System.out.println("readValue = " + readValue);
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: jsoup remove element 
Java :: pythagoras method in java 
Java :: java string 
Java :: Read json url in android - NAYCode.com 
Java :: java clear scanner 
Java :: the diameter of a binary tree 
Java :: get sum of array and return string 
Java :: my maven project give error when adding javax.xml.bind dependency 
Java :: java linkedlist poll 
Java :: GetMapping("/rest/v1/books") in spring rest api 
Java :: permutation and combination program in java 
Java :: measure view height android 
Java :: one line hashmap java 
Java :: java clear bufffer to take next string inpuit 
Java :: java 2d jagged array example 
Java :: java string strip 
Java :: lambda function java 
Java :: Java How to use ConcurrentMap? 
Java :: java switch tutorial 
Java :: pyramid pattern java 
Java :: streams in java 
Java :: java binary exponentiation 
Java :: convert json to xml in java 
Java :: encryption 
Java :: math.pow(x2-x1,2) 
Java :: variable might not have been initialized error 
Java :: java put() method 
Java :: playwright java 
Java :: array 2 
Java :: search and delete class files from jars 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =