Skip to main content
Jump to: navigation, search

EclipseLink/Examples/MOXy/JSON Geocode

JSON Binding: Google Geocode Example

This example will demonstrate mapping a single object model to both XML and JSON using the same set of metadata. Google Maps Geocoding API V2 will be used to provide the XML and JSON inputs for this example.

XML Input

Below is the link we will use to get the data as XML. This is specified in the output parameter.,+Mountain+View,+CA&output=xml&sensor=false&key=YOUR_KEY_HERE


Below is an example of the XML returned from Google Maps:

<?xml version="1.0" encoding="UTF-8" ?>
<kml xmlns="">
  <name>1600 Amphitheatre Parkway, Mountain View, CA</name>
  <Placemark id="p1">
   <address>1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA
   <AddressDetails Accuracy="8"
       <LocalityName>Mountain View</LocalityName>
        <ThoroughfareName>1600 Amphitheatre Pkwy</ThoroughfareName>
    <LatLonBox north="37.4227454" south="37.4200474" east="-122.0843863"
     west="-122.0870843" />

Back to the top