2016-03-29 12 views
-2

[{"statusCode":200,"body":null,"string":"{\"authenticationResultCode\":\"ValidCredentials\",\"brandLogoUri\":\"http:\\\/\\\/dev.virtualearth.net\\\/Branding\\\/logo_powered_by.png\",\"copyright\":\"Copyright © 2016 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.\",\"resourceSets\":[{\"estimatedTotal\":1,\"resources\":[{\"__type\":\"Location:http:\\\/\\\/schemas.microsoft.com\\\/search\\\/local\\\/ws\\\/rest\\\/v1\",\"bbox\":[38.251775282429321,-85.764416391531825,38.259500717570674,-85.751299608468173],\"name\":\"425 W Market St, Louisville, KY 40202\",\"point\":{\"type\":\"Point\",\"coordinates\":[38.255638,-85.757858]},\"address\":{\"addressLine\":\"425 W Market St\",\"adminDistrict\":\"KY\",\"adminDistrict2\":\"Jefferson Co.\",\"countryRegion\":\"United States\",\"formattedAddress\":\"425 W Market St, Louisville, KY 40202\",\"locality\":\"Louisville\",\"postalCode\":\"40202\"},\"confidence\":\"High\",\"entityType\":\"Address\",\"geocodePoints\":[{\"type\":\"Point\",\"coordinates\":[38.255638,-85.757858],\"calculationMethod\":\"Parcel\",\"usageTypes\":[\"Display\"]},{\"type\":\"Point\",\"coordinates\":[38.255367279052734,-85.757896423339844],\"calculationMethod\":\"Interpolation\",\"usageTypes\":[\"Display\",\"Route\"]}],\"matchCodes\":[\"Good\"]}]}],\"statusCode\":200,\"statusDescription\":\"OK\",\"traceId\":\"6bcd334413524cdba8d5c58e85cc1028|HK20271556|02.00.153.400|HK2SCH010280724, HK2SCH010310229\"}"}]o dize biçimi tek sıra değerinde olduğunu, java

Bu benim Girdi kullanarak json dize değerleri olsun.
İçindeki tüm değerleri (resourceSets etiketi) almamız gerekiyor Bu değerleri nasıl alabilirim?

cevap

0

Gson library ile deneyin ... Json'dan bir yöntem ve bir POJO ihtiyacınız olan her şeydir.

0

Her zaman bir ObjectMapper (jackson kütüphanesi) kullanmak ve gönderme veya bunun için Guava kütüphaneleri kullanmak edilir JSON sığan bir POJO eşleyebilirsiniz (kontrol edin: JSON parsing using Gson for Java)