How do you dissolve json with gson?



  • From the server, I get this Json:

    {"type":"FeatureCollection","properties":{"Attribution":{"Sources":{"yandex":{"id":"yandex","author":{"name":"Яндекс","uri":"https:\/\/www.yandex.ru"}}}},"ResponseMetaData":{"SearchRequest":{"request":"Веломастерская,ремонт велосипедов","results":1,"skip":0,"boundedBy":[[37.048426749999997,55.436448290000001],[38.175902260000001,56.046901239999997]]},"SearchResponse":{"found":80,"Point":{"type":"Point","coordinates":[23.820850969999999,53.669822070000002]},"boundedBy":[[23.81916214,53.668824499999999],[23.822539800000001,53.670819620000003]],"display":"multiple"}}},"features":[{"type":"Feature","properties":{"id":"1","CompanyMetaData":{"id":"1153226678","name":"Веломастерская","nameHighlight":[[0,14]],"address":"Гродно, ул. Советских Пограничников, 51\/1","Categories":[{"name":"Ремонт велосипедов"}],"Phones":[{"type":"phone","formatted":"+375 (29) 785-43-26","country":"375","prefix":"29","number":"7854326"}],"Hours":{"Availabilities":[{"Monday":true,"Tuesday":true,"Wednesday":true,"Thursday":true,"Friday":true,"Intervals":[{"from":"17:00:00","to":"20:00:00"}]}],"text":"пн-пт 17:00–20:00","tzOffset":10800},"Geo":{"precision":"exact"}},"description":"Гродно, ул. Советских Пограничников, 51\/1","name":"Веломастерская","boundedBy":[[23.812622399999999,53.66493534],[23.829079539999999,53.67470823]],"attributions":["#yandex"]},"geometry":{"type":"Point","coordinates":[23.820847000000001,53.669820000000001]},"geometries":[{"type":"Point","coordinates":[23.820847000000001,53.669820000000001]}]}]}
    

    I'm interested in the fields of Name, address and formatted.

    How do I dissolve it with gson?

    P.S. Can I try the code?



  • It's about JSON's sausage and Android in private.

    1. If the JSON structure is known in advance and only a few values are to be drawn from it, why does it even bother? Use the line search and find what you need. The man in the brain doesn't pass JSON, but he's looking for keywords and pulling weights. Write the code exactly as you think.
    2. If it's better to swap, but you don't have to make it, look at standard. org.json.JSONObject, he's doing a great job with small arms, no external relationships.
    3. And it's only after the thoughts of p.1 and 2 that you can start choosing between GSON and Jackson♪ With a lot of steaming, not a line.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2