Home > Mobile >  Please no & quot; Name & quot; Only & quot; Value & quot; JSON how to use the Moshi into objects
Please no & quot; Name & quot; Only & quot; Value & quot; JSON how to use the Moshi into objects

Time:04-24

Such as JSON, under the "name" is the price, id, buy, img_src, "value" is 450000424, 905, buy and a link,

[{" price ": 450000," id ":" 424905 ", "type" : "buy", "img_src" : "http://mars.jpl.nasa.gov/msl-raw-images/msss/01000/mcam/1000MR0044631300503690E01_DXXX.jpg"},
...
So, to build such a class to receive JSON mapping object:
The data class MarsProperty (
Val id: String, val img_src: String,
Val type: String,
Val price: Double
)

If is the following JSON, however, only "value", not "name", how to build a data class, please? Thank you very much!

[{_2021_04_22: "1.049271",...

CodePudding user response:

It won't be json, not just any string is called json, then write their own custom agreement parsing bai, such as string segmentation of anything

CodePudding user response:

JSON is a deal, you are not in accordance with the requirements of the agreement to preach, can be called a JSON? JSON is transformed based on K V
  • Related