0
[{
    "id": 1,
    "name": "Couleur",
    "price_per_night": 400000,
    "phone_number": "(021) 54399936",
    "image": "https://lh5.googleusercontent.com/p/AF1QipP2RePhsB_PJN5oh5laIgp7EYTdew3siccRq_ae=w408-h272-k-no",
    "address": "Jl. Lkr. Luar Barat No.1A, RT.10/RW.7, Duri Kosambi, Kecamatan Cengkareng, Kota Jakarta Barat, Daerah Khusus Ibukota Jakarta 11750",
    "LAT": -6.1626827,
    "LNG": 106.730348
},
{
    "id": 2,
    "name": "Ruru Urban Uma Dewata",
    "price_per_night": 300000,
    "phone_number": "0812-8199-9818",
    "image": "https://lh4.googleusercontent.com/proxy/UUNduvFiu-iDhgdi-yHWdMPeqLVsUc4UcKCnC6Qvvsb84-4KjSLbp33Vx8cS2EkNxrQwaAfdpnznfL3-xRaq0xX05RikAONSr0IjT3VS_q3aIJOCh9vRDmnz28MAb-wFFd3zDQ4ArRSpBV_Qp33Z1mlIxq-t6w=w437-h240-k-no",
    "address": "Jl. Kembangan Abadi III No.14, RT.2/RW.8, Kembangan Sel., Kec. Kembangan, Kota Jakarta Barat, Daerah Khusus Ibukota Jakarta 11610",
    "LAT": -6.1707535,
    "LNG": 106.7297894
}]

How to parse this JSON in JAVA (android studio)? where can I find tutorial with this JSON? because its seems most people not using this type of JSON so I could not find one.

Sitgmag
  • 1
  • 1

1 Answers1

0

What do you mean by this:

"most people not using this type of json" ?

Anyway, JSON is standardized and pretty straight forward. Assuming you are using Javascript, then the answers in this thread might be useful: stackflow thread: How to read an external local JSON file in JavaScript? (see the answer from "Ashfedy" in that thread)

You can easily parse the object with:

//have a STRING (!) containing the JSON data
const data = '[{"id": 1,"name": "Couleur","price_per_night": 400000,"phone_number": "(021) 54399936","image": "abcabc","address": "defdef","LAT": -6.1626827,"LNG": 106.730348},'+
'{"id": 2,"name": "Ruru Urban Uma Dewata","price_per_night": 300000,"phone_number": "0812-8199-9818","image": "abcabc","address": "ghighi","LAT": -6.1707535,"LNG": 106.7297894}]'

//parse it
var mydata = JSON.parse(data);

//play with the object (or in this case an array with 2 objects) you just gathered
console.log(mydata[1].phone_number)
ot98ikyq
  • 69
  • 5
  • Did you see this question? https://stackoverflow.com/questions/2591098/how-to-parse-json-in-java - The concept is similar in java: 1. assign the JSON-string a variable 2. parse it, using a library 3. have fun with the object you just created – ot98ikyq Jun 10 '20 at 14:00