How to convert JSON String to Java object - Jackson Example

JSON, stands for JavaScript object notation, is a light weight text or string representation of object and quickly becoming a popular data exchange format. Though it's pretty early to say that JSON is going to replace XMLas popular data interchange format, It is certainly providing an alternative. JSON represent data in two format either an object or an array. JSON object is an unordered collection of key and value, similar to String representation of hashtable. On the other hand JSON Array is an ordered collection of values. Main difference between  JSON Object and  JSON array is there representation. JSON object is started with left brace { and ends with right brace } and key values are separated using colon (:). On the other hand JSON Array starts with left bracket [ and ends with right bracket ] and each value is separated with comma. By looking at structure, You can write  your JSON parser to parse JSON object or array to Java object, but you don't need to. There are lot of open source library in Java which provides tried and tested way of converting JSON String to Java object e.g. Jackson and GSON. In this Java tutorial we will see example of converting a JSON String to Java object using Jackson library
Read more »

0 Response to "How to convert JSON String to Java object - Jackson Example"

Posting Komentar