A basic type of mutual transfer
1.String with other base types (here common base types and corresponding wrapper classes are replaced with type, type)
A. Turn string:string. ValueOf (base variable)
B. String to base class: Type.valueof (string variable) return type is wrapper class
parseType (string variable) return types are the underlying type
2. Conversion of the underlying types to each other
General idea: Now convert it to a string and then to the desired type.
Two JSON format string to Bean
1. Transfer through Gson
Gson Gson = new Gson ();
Bean bean = Gson.fromjson (jsondata,bean. Class);
2. Transfer through Jsonobject
Jsonobject Jsonbean = Jsonobject.fromobject (JSONSTR);
Jsonobjec.tobean (Jsonbean,bean);
Note : When you convert by Gson, all the double data in the JSON data is converted to type int. Method 2 does not have this disadvantage.
-------------not finished---------------follow up and slowly add!
Data type conversions for Java basics