4

In C# I would Deserialize JSON like this, I want to know is there anything available in java that does it the same way? really like this way its clean simple and easy to work it. anyone have a equivalent to it?

  string json = @"{
      'Name': 'Bad Boys',
      'ReleaseDate': '1995-4-7T00:00:00',
      'Genres': [
        'Action',
        'Comedy'
      ]
    }";

Movie m = JsonConvert.DeserializeObject<Movie>(json);

string name = m.Name;
2
  • Look for Gson (code.google.com/p/google-gson) Commented May 22, 2015 at 11:18
  • 1
    Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow Commented May 22, 2015 at 11:19

1 Answer 1

5

I often use gson from google, it's very simple and does the job:

https://code.google.com/p/google-gson/

To deserialize object:

Movie movie = new Gson().fromJson(json, Movie.class);
Sign up to request clarification or add additional context in comments.

1 Comment

Really Like this one going to try it! thanks

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.