Convert a JSON string to object in Java ME?

前端 未结 14 922
有刺的猬
有刺的猬 2020-11-22 02:12

Is there a way in Java/J2ME to convert a string, such as:

{name:\"MyNode\", width:200, height:100}

to an internal Object representation of

14条回答
  •  不思量自难忘°
    2020-11-22 02:59

    GSON is a good option to convert java object to json object and vise versa.
    It is a tool provided by google.

    for converting json to java object use: fromJson(jsonObject,javaclassname.class)
    for converting java object to json object use: toJson(javaObject)
    and rest will be done automatically

    For more information and for download

提交回复
热议问题