Monday, 7 October 2019

javascript - Deserializing Json Object in java




I cannot figure it out, I should deserialize a json object of this type:



{
"value":integer",
"total":1",
"records":138",
"rows":[
{

"value1":6,
"value2":true,
"bool":true,
"floatNumber":140.41",
"floatNumber2":28.7",
"floatNumber3":140.41",
"cssClassName":""",
"date":"19/03/2022"",
"UTCdate":"2016-03-22T00:00:00+0000"",
"UTCdate2":"2016-03-24T20:45:25+0000"

},
{
"value1":6,
"value2":true,
"bool":true,
"floatNumber":140.41",
"floatNumber2":28.7",
"floatNumber3":140.41",
"cssClassName":""",
"date":"19/03/2022"",

"UTCdate":"2016-03-22T00:00:00+0000"",
"UTCdate2":"2016-03-24T20:45:25+0000"}
]}



but I do not know how to do. I wish that this item was added to my class, pointing to what value to assign the corresponding property.



I tried to use Flexjson library but didn't saw any function that will let me what i want to do.



Where to start?




PS: I never serialized an object to JSON, so I do not know how it works.


Answer



You can go through this tutorial. Hope it will help you.




  1. How to convert Java object to / from JSON (Jackson)

  2. https://dzone.com/articles/deserializing-json-java-object


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...