Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
Is it possible to work with json type in java spring boot?

Is it possible to work with json type as in javascript without generating JSONOject in java spring boot? Is it possible to work with the { } format without creating a JSONObject?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

JSON stands for "JavaScript Object Notation". The Java Syntax does not support JSON. Therefore, we cannot use JSON to declare any object in Java like

MyAwesomeObject object = { "name": "foo", "age": 42 };

We can, however, convert a String that contains a JSON-string into a JSONObject. See this question by dogbane for details.

If we use, for example, jackson, we can convert a String to an object through jackson's ObjectMapper:

final String json = "{ \"name\": \"foo\", \"age\": 42 }";
try {
    MyAwesomeObject object = objectMapper.readValue(json, MyAwesomeObject.class);
} catch (IOException e) {
    ...
}

For more details on jackson, I recommend reading this tutorial from baeldung.com.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!