blob: e5d2a8684e6f663955431740331089c5d9c8f39f [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- -->
<!-- Copyright 2008 Google Inc. -->
<!-- Licensed under the Apache License, Version 2.0 (the "License"); you -->
<!-- may not use this file except in compliance with the License. You may -->
<!-- may obtain a copy of the License at -->
<!-- -->
<!-- -->
<!-- -->
<!-- Unless required by applicable law or agreed to in writing, software -->
<!-- distributed under the License is distributed on an "AS IS" BASIS, -->
<!-- implied. License for the specific language governing permissions and -->
<!-- limitations under the License. -->
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link type="text/css" rel='stylesheet' href='JSON.css'>
<title>JSON Interoperability Example</title>
<script type="text/javascript" language='javascript' src='json/json.nocache.js'></script>
<div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color:white; border: 1px solid red; padding: 4px; font-family: sans-serif">
Your web browser must have JavaScript enabled
in order for this application to display correctly.
<h1>JSON Interop Using JSNI</h1>
<div class="intro">
This example application demonstrates a simple approach to
interoperating with services that return their output in JSON format.
It uses GWT's JavaScript Native Interface (JSNI) to analyze a JSON
response and create Java-accessible objects. The JSON classes in this sample
are general-purpose and can be reused in other projects if you find
them useful.
When you click the "Search" button below, you can browse the cached
results of a Yahoo JSON image search for "potato." The response is
parsed into Java objects which are used to populate a tree view below.
<li>For more details on how the JSON response is parsed into a set
of Java objects, see the JSONParser class.
<li>The search URL used in this example was
<a href=';query=potato&amp;results=2&amp;output=json'>;query=potato&amp;results=2&amp;output=json</a>.
<div id="search">
<table align="center" width="80%" style="margin-top: 1em">
<tr><th style="text-align: center; margin: 1em">JSON Response Tree View</th></tr>
<tr><td id="tree"></td></tr>